bugfix: 输入内容会携带报告标签

This commit is contained in:
2026-03-10 16:28:11 +08:00
parent b997f10cfc
commit e934d77f95
4 changed files with 35 additions and 40 deletions

View File

@@ -8,15 +8,10 @@ export interface AgentParamsType {
imageUrlList?: string[] // 图片URL列表
configParams: Record<string, any> // 其他配置参数
token: string
needSuggestion?: boolean
useReport: bolean
}
export const fetchAgentReply = (data: AgentParamsType): Promise<AgentResponse> => {
return request({
url: '/api/ai-design/chat',
method: 'get',
data,
meta: { responseAll: true }
})
}
export const chatUrl = '/api/ai-design/chat'
export interface CreateProjectParamsType {
type: string
@@ -33,11 +28,11 @@ export const createProject = (data: CreateProjectParamsType): Promise<any> => {
* @param data 获取项目信息参数
* @param data.id 项目id
* @returns 获取项目信息
*/
*/
export const getProjectInfo = (data) => {
return request({
url: `/api/project/${data.id}`,
method: 'get',
method: 'get'
})
}
@@ -47,7 +42,7 @@ export const getProjectInfo = (data) => {
* @param params.page 页码
* @param params.size 每页数量
* @returns 获取项目版本列表
*/
*/
export const getProjectList = (params) => {
return request({
url: `/api/project/list`,
@@ -66,7 +61,7 @@ export const getProjectList = (params) => {
* @param data.style 项目风格
* @param data.temperature 项目温度
* @returns 修改项目信息
*/
*/
export const updateProject = (id: string, data: Object) => {
return request({
url: `/api/project/${id}`,
@@ -78,10 +73,10 @@ export const updateProject = (id: string, data: Object) => {
* 删除项目
* @param id 项目id
* @returns 删除项目
*/
*/
export const deleteProject = (id: string) => {
return request({
url: `/api/project/${id}`,
method: 'delete',
method: 'delete'
})
}

View File

@@ -7,23 +7,20 @@ import MyEvent from '@/utils/myEvent'
// Agent 项目初始数据 store
type InitialProjectData = {
text: string
images: Array<{ url: string; name: string }>
type: string
area: string
style: string
useReport:boolean
needSuggestion:boolean
}
export const useAgentStore = defineStore('agent', () => {
const initialProjectData = ref<{
text: string
images: Array<{ url: string; name: string }>
type: string
area: string
style: string
} | null>(null)
const initialProjectData = ref<InitialProjectData | null>(null)
// 保存项目初始数据
const setInitialProjectData = (data: {
text: string
images: Array<{ url: string; name: string }>
type: string
area: string
style: string
}) => {
const setInitialProjectData = (data: InitialProjectData) => {
initialProjectData.value = data
}

View File

@@ -24,10 +24,9 @@
import { ref, reactive, computed, onUnmounted, onMounted, nextTick, watch } from 'vue'
import List from './List.vue'
import Input from '../../components/Input.vue'
import { fetchAgentReply } from '@/api/agent'
import { chatUrl } from '@/api/agent'
import type { AgentParamsType } from '@/api/agent'
import { useUserInfoStore, useProjectStore } from '@/stores'
import { useAgentStore } from '@/stores/agent'
import { useUserInfoStore, useProjectStore, useAgentStore } from '@/stores'
const userStore = useUserInfoStore()
const agentStore = useAgentStore()
@@ -54,6 +53,8 @@
message: '',
token: userStore.state.token,
versionID: '',
needSuggestion: false,
useReport: false,
configParams: {
type: '',
region: '',
@@ -99,6 +100,8 @@
style: initialData.style,
temperature: 0.7
}
params.needSuggestion = initialData.needSuggestion || false
params.useReport = initialData.useReport
handleSendMessage({
text: initialData.text,
images: initialData.images,
@@ -158,7 +161,7 @@
configParams: JSON.stringify(params.configParams)
})
const BASEURL = import.meta.env.VITE_APP_URL
const response = await fetch(`${BASEURL}/api/ai-design/chat?${urlParams.toString()}`, {
const response = await fetch(`${BASEURL}${chatUrl}?${urlParams.toString()}`, {
method: 'GET',
signal: abortController.signal
})
@@ -221,7 +224,7 @@
}
buffer += decoder.decode(value, { stream: true })
// 优先按空行拆分事件块SSE标准
let events = buffer.split(/\n\n/)
buffer = events.pop() // 保留不完整块
@@ -469,11 +472,10 @@
// 延迟设置新数据,确保 UI 有时间响应清空操作
nextTick(() => {
messageList.value = [...ancestorsList, ...currentList]
params.versionID = current?.id
sketchList.value = imgList
console.log('11111111111111',params.versionID);
console.log('11111111111111', params.versionID)
})
}

View File

@@ -20,7 +20,6 @@
</div>
</div>
<div class="editor-wrapper">
<!-- 静态占位符 - 当编辑器为空时显示 -->
<div v-if="showPlaceholder" class="editor-placeholder">
{{ $t('Input.placeholder') }}
</div>
@@ -506,8 +505,9 @@
let node: Node | null
while ((node = walker.nextNode())) {
if (node.parentElement?.classList.contains('custom-placeholder')) continue
if (node.parentElement?.classList.contains('editor-tag')) continue
// 使用 closest() 检查当前节点的祖先元素是否包含需要排除的 class
if (node.parentElement?.closest('.custom-placeholder')) continue
if (node.parentElement?.closest('.editor-tag')) continue
text += node.textContent
}
@@ -732,14 +732,15 @@
)
const handleCreateProject = async () => {
// 这里可以添加创建项目的逻辑
if (!inputValue.value.trim()) {
return
}
const params = {
type: typeValue.value,
area: areaValue.value,
style: styleValue.value,
useReport: reportTags.value.length > 0,
temperature: 0.7
}
const projectres = await createProject(params)
@@ -1035,7 +1036,7 @@
min-height: 5rem;
line-height: 1.4rem;
}
.editor-placeholder{
.editor-placeholder {
font-family: 'Regular';
font-size: 1.4rem;
padding: 0;