...
const tag = document.createElement('div')
- tag.className = 'editor-tag report-btn flex-center'
tag.contentEditable = 'false'
-
const imgLeft = document.createElement('img')
- imgLeft.className = 'light-icon'
- imgLeft.src = lightIcon as unknown as string
-
- const textSpan = document.createElement('span')
- textSpan.innerText = t('Input.trendingReport')
-
const imgClose = document.createElement('img')
+ const textSpan = document.createElement('span')
imgClose.className = 'close-icon'
- imgClose.src = closeIcon as unknown as string
+ if (text) {
+ tag.className = 'editor-tag restore flex-center'
+ imgLeft.className = 'restore-icon'
+ imgLeft.src = restoreIcon as unknown as string
+ imgClose.src = restoreCloseIcon as unknown as string
+ imgClose.className = 'close-icon restore'
+ textSpan.className = 'restore-text'
+ } else {
+ tag.className = 'editor-tag report-btn flex-center'
+ imgLeft.className = 'light-icon'
+ imgLeft.src = lightIcon as unknown as string
+ imgClose.src = closeIcon as unknown as string
+ }
+
+
+ textSpan.innerText = tagText
+
imgClose.addEventListener('click', (ev) => {
ev.stopPropagation()
// remove tag when close clicked
@@ -398,11 +413,17 @@
}
}
- const handleKeyPress = (e) => {
+ const handleKeyDown = (e) => {
// 检测回车
if (e.key === 'Enter') {
+ console.log('11111111111')
+
e.preventDefault()
- handleSendAgent()
+ if (props.isAgentMode) {
+ handleSendAgent()
+ } else {
+ handleCreateProject()
+ }
return
}
if (e.key === 'Backspace') {
@@ -446,12 +467,20 @@
}
const handleSendAgent = async () => {
+ console.log('发送信息--------')
+
if (props.generating) {
emits('pause')
return
}
if (!inputValue.value.trim()) return
- emits('send', { text: inputValue.value.trim(), images: uploadedImages.value })
+ console.log('222222')
+
+ const payload = { text: inputValue.value.trim(), images: uploadedImages.value }
+ console.log('准备发送 send 事件', payload)
+ emits('send', payload)
+ console.log('send 事件已发送')
+
// 发送后清空输入框
if (editorRef.value) {
editorRef.value.innerHTML = ''
@@ -534,7 +563,7 @@
temperature: 0.7
}
const projectres = await createProject(params)
- console.log('projectres', projectres)
+ // console.log('projectres', projectres)
projectStore.setId(projectres)
// 保存初始数据到 store
agentStore.setInitialProjectData({
@@ -543,9 +572,14 @@
...params
})
- console.log('Create project with:', params)
+ // console.log('Create project with:', params)
router.push('/home/agent', { query: params })
}
+
+ // 暴露方法给父组件
+ defineExpose({
+ addReportTag
+ })
diff --git a/src/views/home/components/style.ts b/src/views/home/components/style.ts
index 0e59efb..189ae29 100644
--- a/src/views/home/components/style.ts
+++ b/src/views/home/components/style.ts
@@ -25,35 +25,15 @@ function slugify(str) {
* @returns { string | null } 返回可直接用于
![]()
的 URL
*/
export function getStyleImage(types, style) {
-
- if (!types) types = 'Sofa'
+ if (!types) types = 'Sofa'
const type = types.toLowerCase()
const map = imagesMaps[type]
-
+
const fileName = `${slugify(style)}.png`
const key = `/src/assets/images/${type}/${fileName}`
- console.log('types',types, 'style',style, 'fileName',fileName, 'key',key);
if (map[key]) {
return map[key].default
}
return ''
}
-
-const styleList = [
- 'Venetian Modern',
- 'Coastal',
- 'Maximalism',
- 'Memphis',
- 'Verdant',
- 'Century Chrome',
- 'Modern Revival',
- 'Transitional',
- "Tuscan 2000's",
- 'Kitsch-core',
- 'Bauhaus',
- 'Constructivism',
- 'Nordic Noir',
- 'Dopamine',
- 'Squiggle'
-]