From 749ed8d7578dace5120700e2fa90ec62700f1ff2 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sun, 24 May 2026 00:47:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=89=8D=E7=AB=AF=20Agent=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AgentRuntimeConfigForm 从 AgentConfigSidebar 重命名 - AgentChatComponent、AgentInputArea、AgentMessageComponent 重写交互逻辑 - AgentPanel、AgentArtifactsCard、AgentView 适配新数据模型 - stores/agent.js 简化状态管理 - BasicSettingsSection、ShareConfigForm、DebugComponent 收敛配置 - SubagentCardList、ToolsCardList 适配新 API - useApproval 逻辑优化 --- web/src/apis/agent_api.js | 57 +-- web/src/components/AgentArtifactsCard.vue | 15 +- web/src/components/AgentChatComponent.vue | 360 ++++---------- web/src/components/AgentInputArea.vue | 176 ++++++- web/src/components/AgentMessageComponent.vue | 128 ++++- web/src/components/AgentPanel.vue | 55 +-- ...Sidebar.vue => AgentRuntimeConfigForm.vue} | 417 ++-------------- web/src/components/BasicSettingsSection.vue | 49 +- web/src/components/DebugComponent.vue | 5 +- web/src/components/ShareConfigForm.vue | 53 +- .../extensions/SubagentCardList.vue | 6 +- .../components/extensions/ToolsCardList.vue | 10 +- web/src/composables/useApproval.js | 11 +- web/src/stores/agent.js | 460 ++++-------------- web/src/views/AgentView.vue | 228 ++++----- 15 files changed, 725 insertions(+), 1305 deletions(-) rename web/src/components/{AgentConfigSidebar.vue => AgentRuntimeConfigForm.vue} (78%) diff --git a/web/src/apis/agent_api.js b/web/src/apis/agent_api.js index aff078a9..27d441ec 100644 --- a/web/src/apis/agent_api.js +++ b/web/src/apis/agent_api.js @@ -3,7 +3,6 @@ import { apiPost, apiDelete, apiPut, - apiAdminPost, apiRequest } from './base' import { useUserStore } from '@/stores/user' @@ -31,7 +30,7 @@ export const agentApi = { ...useUserStore().getAuthHeaders() } - return fetch('/api/chat/agent', { + return fetch('/api/agent/chat', { method: 'POST', body: JSON.stringify(data), signal, @@ -64,24 +63,20 @@ export const agentApi = { return response.response }, - /** - * 获取默认智能体 - * @returns {Promise} - 默认智能体信息 - */ - getDefaultAgent: () => apiGet('/api/chat/default_agent'), - /** * 获取智能体列表 * @returns {Promise} - 智能体列表 */ - getAgents: () => apiGet('/api/chat/agent'), + getAgents: () => apiGet('/api/agent'), + + getAgentBackends: () => apiGet('/api/agent/backends'), /** * 获取单个智能体详情 * @param {string} agentId - 智能体ID * @returns {Promise} - 智能体详情 */ - getAgentDetail: (agentId) => apiGet(`/api/chat/agent/${agentId}`), + getAgentDetail: (agentId) => apiGet(`/api/agent/${agentId}`), /** * 获取智能体历史消息 @@ -117,36 +112,16 @@ export const agentApi = { getMessageFeedback: (messageId) => apiGet(`/api/chat/message/${messageId}/feedback`), - getAgentConfigs: (agentId) => apiGet(`/api/chat/agent/${agentId}/configs`), + createAgent: (payload) => apiPost('/api/agent', payload), - getAgentConfigProfile: (agentId, configId) => - apiGet(`/api/chat/agent/${agentId}/configs/${configId}`), + updateAgent: (agentId, payload) => apiPut(`/api/agent/${agentId}`, payload), - createAgentConfigProfile: (agentId, payload) => - apiPost(`/api/chat/agent/${agentId}/configs`, payload), - - updateAgentConfigProfile: (agentId, configId, payload) => - apiPut(`/api/chat/agent/${agentId}/configs/${configId}`, payload), - - setAgentConfigDefault: (agentId, configId) => - apiPost(`/api/chat/agent/${agentId}/configs/${configId}/set_default`, {}), - - deleteAgentConfigProfile: (agentId, configId) => - apiDelete(`/api/chat/agent/${agentId}/configs/${configId}`), - - /** - * 设置默认智能体 - * @param {string} agentId - 智能体ID - * @returns {Promise} - 设置结果 - */ - setDefaultAgent: async (agentId) => { - return apiAdminPost('/api/chat/set_default_agent', { agent_id: agentId }) - }, + deleteAgent: (agentId) => apiDelete(`/api/agent/${agentId}`), /** * 恢复被人工审批中断的对话(流式响应) - * @param {string} agentId - 智能体ID - * @param {Object} data - 恢复数据 { thread_id, answer: { question_id: answer }, approved } + * @param {string} threadId - 会话 ID + * @param {Object} data - 恢复数据 { answer: { question_id: answer }, approved } * @param {Object} options - 可选参数(signal, headers等) * @returns {Promise} - 恢复响应流 */ @@ -175,9 +150,9 @@ export const agentApi = { * @returns {Promise} */ createAgentRun: (data) => - apiPost('/api/chat/runs', { + apiPost('/api/agent/runs', { query: data.query, - agent_config_id: data.agent_config_id, + agent_id: data.agent_id, thread_id: data.thread_id, meta: data.meta || {}, image_content: data.image_content || null @@ -188,21 +163,21 @@ export const agentApi = { * @param {string} runId - run ID * @returns {Promise} */ - getAgentRun: (runId) => apiGet(`/api/chat/runs/${runId}`), + getAgentRun: (runId) => apiGet(`/api/agent/runs/${runId}`), /** * 取消 Run * @param {string} runId - run ID * @returns {Promise} */ - cancelAgentRun: (runId) => apiPost(`/api/chat/runs/${runId}/cancel`, {}), + cancelAgentRun: (runId) => apiPost(`/api/agent/runs/${runId}/cancel`, {}), /** * 获取线程活跃 Run * @param {string} threadId - 线程ID * @returns {Promise} */ - getThreadActiveRun: (threadId) => apiGet(`/api/chat/thread/${threadId}/active_run`), + getThreadActiveRun: (threadId) => apiGet(`/api/agent/thread/${threadId}/active_run`), /** * 打开 Run 事件 SSE 连接(调用方负责关闭) @@ -214,7 +189,7 @@ export const agentApi = { streamAgentRunEvents: (runId, afterSeq = '0-0', options = {}) => { const { signal } = options return fetch( - `/api/chat/runs/${runId}/events?after_seq=${encodeURIComponent(String(afterSeq))}`, + `/api/agent/runs/${runId}/events?after_seq=${encodeURIComponent(String(afterSeq))}`, { method: 'GET', headers: { diff --git a/web/src/components/AgentArtifactsCard.vue b/web/src/components/AgentArtifactsCard.vue index eb21dda9..8ca2297a 100644 --- a/web/src/components/AgentArtifactsCard.vue +++ b/web/src/components/AgentArtifactsCard.vue @@ -47,14 +47,6 @@ const props = defineProps({ threadId: { type: String, default: null - }, - agentId: { - type: String, - default: null - }, - agentConfigId: { - type: [String, Number], - default: null } }) const emit = defineEmits(['saved', 'open-preview']) @@ -104,12 +96,7 @@ const downloadFile = async (file) => { if (!props.threadId || !file?.path) return try { - const response = await downloadViewerFile( - props.threadId, - file.path, - props.agentId, - props.agentConfigId - ) + const response = await downloadViewerFile(props.threadId, file.path) const blob = await response.blob() const contentDisposition = response.headers.get('Content-Disposition') || response.headers.get('content-disposition') diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue index fb92c2bf..6037a23e 100644 --- a/web/src/components/AgentChatComponent.vue +++ b/web/src/components/AgentChatComponent.vue @@ -52,8 +52,6 @@ v-if="shouldShowArtifacts(row.conv)" :artifacts="currentArtifacts" :thread-id="currentChatId" - :agent-id="currentThread?.agent_id || currentAgentId" - :agent-config-id="selectedAgentConfigId" @saved="handleArtifactSaved" @open-preview="openPanelPreview" /> @@ -82,7 +80,6 @@ 正在生成回复... -
@@ -101,54 +98,10 @@
-
+

{{ randomGreeting }}

-
- -
- -
- - - - -
- - -
-
-
- {{ question.text }} -
-
-
-

当前智能体:{{ currentThreadAgentName }};请注意辨别内容的可靠性

@@ -208,8 +146,6 @@ v-if="isAgentPanelOpen" :agent-state="currentAgentState" :thread-id="currentChatId" - :agent-id="currentThread?.agent_id || currentAgentId" - :agent-config-id="selectedAgentConfigId" :panel-ratio="panelRatio" :preview-tabs="agentPanelPreviewTabs" :active-preview-path="agentPanelActivePreviewPath" @@ -239,15 +175,13 @@ import { computed, onUnmounted, onActivated, - onDeactivated, - h + onDeactivated } from 'vue' import { message } from 'ant-design-vue' import AgentInputArea from '@/components/AgentInputArea.vue' import AgentMessageComponent from '@/components/AgentMessageComponent.vue' import RefsComponent from '@/components/RefsComponent.vue' import ToolCallsGroupComponent from '@/components/ToolCallsGroupComponent.vue' -import { Bot, Telescope, ChevronDown } from 'lucide-vue-next' import { handleChatError, handleValidationError } from '@/utils/errorHandler' import { ScrollController } from '@/utils/scrollController' import { AgentValidator } from '@/utils/agentValidator' @@ -280,15 +214,8 @@ const agentStore = useAgentStore() const chatThreadsStore = useChatThreadsStore() const chatUIStore = useChatUIStore() const configStore = useConfigStore() -const { - agents, - selectedAgentId, - defaultAgentId, - selectedAgentConfigId, - agentConfig, - configurableItems, - availableKnowledgeBases -} = storeToRefs(agentStore) +const { agents, selectedAgentId, agentConfig, configurableItems, availableKnowledgeBases } = + storeToRefs(agentStore) const { threads, currentThreadId, currentThread } = storeToRefs(chatThreadsStore) // ==================== LOCAL CHAT & UI STATE ==================== @@ -309,20 +236,6 @@ const greetingMessages = [ // 随机选择一个打招呼文本 const randomGreeting = greetingMessages[Math.floor(Math.random() * greetingMessages.length)] -// 从智能体元数据获取示例问题 -const exampleQuestions = computed(() => { - const agentId = currentAgentId.value - let examples = [] - if (agentId && agents.value && agents.value.length > 0) { - const agent = agents.value.find((a) => a.id === agentId) - examples = agent ? agent.metadata?.examples || [] : [] - } - return examples.map((text, index) => ({ - id: index + 1, - text: text - })) -}) - // 业务状态(保留在组件本地) const chatState = reactive({ currentThreadId: null, @@ -383,7 +296,10 @@ const getPanelContainerWidth = () => { const getMaxPanelRatio = (containerWidth = getPanelContainerWidth()) => { if (!containerWidth) return maxPanelRatio - return Math.max(minPanelRatio, Math.min(maxPanelRatio, (containerWidth - minChatMainWidth) / containerWidth)) + return Math.max( + minPanelRatio, + Math.min(maxPanelRatio, (containerWidth - minChatMainWidth) / containerWidth) + ) } const clampPanelRatio = (ratio, containerWidth = getPanelContainerWidth()) => { @@ -416,7 +332,8 @@ const resetAgentPanelState = () => { } const setAgentPanelViewMode = (mode) => { - agentPanelViewMode.value = mode === 'preview' && agentPanelActivePreviewPath.value ? 'preview' : 'tree' + agentPanelViewMode.value = + mode === 'preview' && agentPanelActivePreviewPath.value ? 'preview' : 'tree' if (agentPanelActivePreviewPath.value) { panelRatio.value = clampPanelRatio(previewPanelRatio) @@ -487,10 +404,9 @@ const closePanelPreviewPath = (targetPath) => { // ==================== COMPUTED PROPERTIES ==================== const currentAgentId = computed(() => { if (props.singleMode) { - return props.agentId || defaultAgentId.value - } else { - return selectedAgentId.value + return props.agentId || selectedAgentId.value || agents.value[0]?.id || '' } + return selectedAgentId.value }) const currentAgentName = computed(() => { @@ -502,7 +418,6 @@ const currentAgent = computed(() => { if (!currentAgentId.value || !agents.value || !agents.value.length) return null return agents.value.find((a) => a.id === currentAgentId.value) || null }) -const startAgents = computed(() => agents.value || []) const currentChatId = computed(() => currentThreadId.value) const currentThreadAgentName = computed(() => { @@ -515,8 +430,6 @@ const currentThreadAgentName = computed(() => { } return currentAgentName.value }) -const currentAgentIcon = computed(() => getAgentIconComponent(currentAgentId.value)) - // 检查当前智能体是否支持文件上传 const supportsFileUpload = computed(() => { if (!currentAgent.value) return false @@ -542,6 +455,9 @@ const currentThreadAttachments = computed(() => { if (!currentChatId.value) return [] return threadAttachmentsMap.value[currentChatId.value] || [] }) +const currentPendingThreadAttachments = computed(() => + currentThreadAttachments.value.filter((attachment) => !attachment?.request_id) +) const currentArtifacts = computed(() => { const artifacts = currentAgentState.value?.artifacts return Array.isArray(artifacts) ? artifacts : [] @@ -653,55 +569,6 @@ const conversationRows = computed(() => { return rows }) -// 智能体图标映射 -const agentIconMap = { - ChatbotAgent: Bot, - DeepAgent: Telescope -} - -const getAgentIconComponent = (agentId) => { - return agentIconMap[agentId] || Bot -} - -const agentSegmentOptions = computed(() => { - return startAgents.value.map((agent) => { - const IconComponent = getAgentIconComponent(agent.id) - return { - label: () => - h('div', { class: 'agent-option-label' }, [ - h(IconComponent, { size: 16, class: 'agent-option-icon' }), - h('span', null, agent.name || 'Unknown') - ]), - value: agent.id - } - }) -}) - -const showStartAgentSelector = computed(() => { - return !props.singleMode && !conversations.value.length && startAgents.value.length > 1 -}) - -const showStartAgentDropdown = computed(() => { - return ( - showStartAgentSelector.value && - (startAgents.value.length >= 4 || localUIState.chatMainWidth < 380) - ) -}) - -const showStartAgentSegment = computed(() => { - return showStartAgentSelector.value && !showStartAgentDropdown.value -}) - -const handleStartAgentChange = async (agentId) => { - if (!agentId || agentId === currentAgentId.value) return - if (conversations.value.length > 0) return - try { - await agentStore.selectAgent(agentId) - } catch (error) { - handleChatError(error, 'load') - } -} - const isLoadingMessages = computed(() => chatUIStore.isLoadingMessages) const isStreaming = computed(() => { const threadState = currentThreadState.value @@ -736,7 +603,12 @@ const createClientRequestId = () => { return `req-${Date.now()}-${Math.random().toString(36).slice(2, 10)}` } -const buildOptimisticHumanMessage = ({ requestId, text, imageContent = null }) => { +const buildOptimisticHumanMessage = ({ + requestId, + text, + imageContent = null, + attachments = [] +}) => { const message = { id: requestId, role: 'user', @@ -744,7 +616,8 @@ const buildOptimisticHumanMessage = ({ requestId, text, imageContent = null }) = content: text, message_type: imageContent ? 'multimodal_image' : 'text', extra_metadata: { - request_id: requestId + request_id: requestId, + attachments } } @@ -799,15 +672,33 @@ const stripDuplicatedOngoingHumanMessage = (historyConvs, ongoingMessages) => { } // 发送 runs 前先在前端插入一条用户消息,避免等待 worker 轮询后消息才出现。 -const insertOptimisticHumanMessage = (threadState, { requestId, text, imageContent = null }) => { +const insertOptimisticHumanMessage = ( + threadState, + { requestId, text, imageContent = null, attachments = [] } +) => { if (!threadState || !requestId) return threadState.pendingRequestId = requestId threadState.replyLoadingVisible = false threadState.onGoingConv.msgChunks[requestId] = [ - buildOptimisticHumanMessage({ requestId, text, imageContent }) + buildOptimisticHumanMessage({ requestId, text, imageContent, attachments }) ] } +const markAttachmentsRequestId = (threadId, attachments, requestId) => { + if (!threadId || !attachments.length) return null + const previousAttachments = threadAttachmentsMap.value[threadId] || [] + const fileIds = new Set(attachments.map((attachment) => attachment.file_id).filter(Boolean)) + threadAttachmentsMap.value[threadId] = previousAttachments.map((attachment) => + fileIds.has(attachment.file_id) ? { ...attachment, request_id: requestId } : attachment + ) + return previousAttachments +} + +const rollbackAttachments = (threadId, previousAttachments) => { + if (!threadId || !Array.isArray(previousAttachments)) return + threadAttachmentsMap.value[threadId] = previousAttachments +} + const CONFIG_CHANGE_NOTICE_MESSAGE = '在运行过程中切换或修改配置可能会影响最终效果,建议新建一个对话。' @@ -823,7 +714,6 @@ const withConfigNoticeSync = async (task) => { const buildThreadConfigSnapshot = () => { return { agentId: currentAgentId.value || '', - agentConfigId: selectedAgentConfigId.value ?? null, configJson: JSON.stringify(agentConfig.value || {}) } } @@ -912,7 +802,6 @@ const maybeInsertThreadConfigNotice = () => { if ( previousSnapshot.agentId === currentSnapshot.agentId && - previousSnapshot.agentConfigId === currentSnapshot.agentConfigId && previousSnapshot.configJson === currentSnapshot.configJson ) { return @@ -1021,34 +910,6 @@ onUnmounted(() => { }) // ==================== 线程管理方法 ==================== -const setThreadAgentConfigId = (threadId, agentConfigId) => { - if (!threadId) return - const thread = threads.value.find((item) => item.id === threadId) - if (thread) { - thread.metadata = { - ...(thread.metadata || {}), - agent_config_id: agentConfigId ?? null - } - } -} - -const syncSelectedConfigForThread = async (thread) => { - const threadAgentConfigId = thread?.metadata?.agent_config_id - if (!threadAgentConfigId) return - - const targetAgentId = thread.agent_id || currentAgentId.value - if (!targetAgentId) return - - const configList = agentStore.agentConfigs[targetAgentId] || [] - if (!configList.length) { - await agentStore.fetchAgentConfigs(targetAgentId) - } - - if (selectedAgentConfigId.value !== threadAgentConfigId) { - await agentStore.selectAgentConfig(threadAgentConfigId) - } -} - // 获取当前智能体的线程列表 const fetchThreads = async (agentId = null) => { const targetAgentId = props.singleMode ? agentId || currentAgentId.value : agentId @@ -1205,6 +1066,28 @@ const handleAttachmentUpload = async (files) => { } } +const handleAttachmentRemove = async (attachment) => { + const threadId = currentChatId.value + const fileId = attachment?.file_id + if (!threadId || !fileId) return + + const previousAttachments = threadAttachmentsMap.value[threadId] || [] + threadAttachmentsMap.value[threadId] = previousAttachments.filter( + (item) => item.file_id !== fileId + ) + + try { + await threadApi.deleteThreadAttachment(threadId, fileId) + await Promise.all([ + fetchAgentState(currentAgentId.value, threadId), + refreshThreadFilesAndAttachments(threadId) + ]) + } catch (error) { + threadAttachmentsMap.value[threadId] = previousAttachments + handleChatError(error, 'delete') + } +} + // ==================== 审批功能管理 ==================== const { approvalState, handleApproval, processApprovalInStream } = useApproval({ getThreadState, @@ -1238,7 +1121,9 @@ const sendMessage = async ({ threadId, text, signal = undefined, - imageData = undefined + imageData = undefined, + requestId = '', + attachmentFileIds = [] }) => { if (!agentId || !threadId || !text) { const error = new Error('Missing agent, thread, or message text') @@ -1246,18 +1131,14 @@ const sendMessage = async ({ return Promise.reject(error) } - if (!selectedAgentConfigId.value) { - const error = new Error('Missing agent_config_id') - handleChatError(error, 'send') - return Promise.reject(error) - } - - setThreadAgentConfigId(threadId, selectedAgentConfigId.value) - const requestData = { query: text, + agent_id: agentId, thread_id: threadId, - agent_config_id: selectedAgentConfigId.value + meta: { + request_id: requestId, + attachment_file_ids: attachmentFileIds + } } // 如果有图片,添加到请求中 @@ -1317,7 +1198,6 @@ const selectChat = async (chatId) => { await agentStore.selectAgent(targetChat.agent_id) } - await syncSelectedConfigForThread(targetChat) syncThreadConfigSnapshot(chatId) }) } catch (error) { @@ -1382,11 +1262,6 @@ const handleSendMessage = async ({ image } = {}) => { if ((!text && !image) || !currentAgent.value || isProcessing.value || sendCooldownActive.value) return - if (!selectedAgentConfigId.value) { - message.error('请先选择智能体配置后再发送消息') - return - } - // 发送后进入短暂冷却,防止连续触发停止 startSendCooldown() @@ -1407,6 +1282,11 @@ const handleSendMessage = async ({ image } = {}) => { const threadState = getThreadState(threadId) if (!threadState) return + const pendingAttachments = [...currentPendingThreadAttachments.value] + const pendingAttachmentFileIds = pendingAttachments + .map((attachment) => attachment.file_id) + .filter(Boolean) + if (useRunsApi) { if ((threadMessages.value[threadId] || []).length === 0) { const autoTitle = text.replace(/\s+/g, ' ').trim().slice(0, 2000) @@ -1434,19 +1314,25 @@ const handleSendMessage = async ({ image } = {}) => { resetOnGoingConv(threadId) const requestId = createClientRequestId() + const previousAttachments = markAttachmentsRequestId(threadId, pendingAttachments, requestId) insertOptimisticHumanMessage(threadState, { requestId, text, - imageContent + imageContent, + attachments: pendingAttachments.map((attachment) => ({ + ...attachment, + request_id: requestId + })) }) threadState.isStreaming = true try { const runResp = await agentApi.createAgentRun({ query: text, - agent_config_id: selectedAgentConfigId.value, + agent_id: currentAgentId.value, thread_id: threadId, meta: { - request_id: requestId + request_id: requestId, + attachment_file_ids: pendingAttachmentFileIds }, image_content: imageContent }) @@ -1459,6 +1345,7 @@ const handleSendMessage = async ({ image } = {}) => { threadState.isStreaming = false threadState.replyLoadingVisible = false threadState.pendingRequestId = null + rollbackAttachments(threadId, previousAttachments) resetOnGoingConv(threadId) handleChatError(error, 'send') } @@ -1493,10 +1380,12 @@ const handleSendMessage = async ({ image } = {}) => { threadState.isStreaming = true resetOnGoingConv(threadId) const requestId = createClientRequestId() + const previousAttachments = markAttachmentsRequestId(threadId, pendingAttachments, requestId) insertOptimisticHumanMessage(threadState, { requestId, text, - imageContent + imageContent, + attachments: pendingAttachments.map((attachment) => ({ ...attachment, request_id: requestId })) }) threadState.streamAbortController = new AbortController() @@ -1506,13 +1395,16 @@ const handleSendMessage = async ({ image } = {}) => { threadId: threadId, text: text, signal: threadState.streamAbortController?.signal, - imageData: image + imageData: image, + requestId, + attachmentFileIds: pendingAttachmentFileIds }) await handleAgentResponse(response, threadId) } catch (error) { if (error.name !== 'AbortError') { console.error('Stream error:', error) + rollbackAttachments(threadId, previousAttachments) handleChatError(error, 'send') } else { console.warn('[Interrupted] Catch') @@ -1586,7 +1478,7 @@ const handleApprovalWithStream = async (answer) => { try { // 使用审批 composable 处理审批 - const response = await handleApproval(answer, currentAgentId.value, selectedAgentConfigId.value) + const response = await handleApproval(answer) if (!response) return // 如果 handleApproval 抛出错误,这里不会执行 @@ -1619,14 +1511,6 @@ const handleQuestionCancel = () => { handleApprovalWithStream('reject') } -// 处理示例问题点击 -const handleExampleClick = (questionText) => { - userInput.value = questionText - nextTick(() => { - handleSendMessage() - }) -} - const buildExportPayload = () => { const agentId = currentAgentId.value let agentDescription = '' @@ -1966,11 +1850,6 @@ watch(currentAgentId, (newAgentId, oldAgentId) => { maybeInsertThreadConfigNotice() }) -watch(selectedAgentConfigId, (newConfigId, oldConfigId) => { - if (oldConfigId === undefined || newConfigId === oldConfigId) return - maybeInsertThreadConfigNotice() -}) - watch( () => JSON.stringify(agentConfig.value || {}), (newConfigJson, oldConfigJson) => { @@ -2122,7 +2001,7 @@ watch(currentChatId, (threadId, oldThreadId) => { transition: none !important; } -.chat-examples-input { +.chat-greeting-input { padding: 24px 0; text-align: center; @@ -2244,45 +2123,6 @@ watch(currentChatId, (threadId, oldThreadId) => { font-size: 12px; } -.example-questions { - margin-top: 16px; - text-align: center; - - .example-chips { - display: flex; - flex-wrap: wrap; - gap: 8px; - justify-content: center; - } - - .example-chip { - padding: 6px 12px; - background: var(--gray-25); - // border: 1px solid var(--gray-100); - border-radius: 16px; - cursor: pointer; - font-size: 0.8rem; - color: var(--gray-700); - transition: all 0.15s ease; - white-space: nowrap; - max-width: 200px; - overflow: hidden; - text-overflow: ellipsis; - - &:hover { - // background: var(--main-25); - border-color: var(--main-200); - color: var(--main-700); - box-shadow: 0 0px 4px rgba(0, 0, 0, 0.03); - } - - &:active { - transform: translateY(0); - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); - } - } -} - .chat-loading { padding: 0 50px; text-align: center; diff --git a/web/src/components/AgentInputArea.vue b/web/src/components/AgentInputArea.vue index 768e2ec7..8bc9c959 100644 --- a/web/src/components/AgentInputArea.vue +++ b/web/src/components/AgentInputArea.vue @@ -13,12 +13,57 @@ @keydown="handleKeyDown" > diff --git a/web/src/components/BasicSettingsSection.vue b/web/src/components/BasicSettingsSection.vue index a4b274ed..411c1a8d 100644 --- a/web/src/components/BasicSettingsSection.vue +++ b/web/src/components/BasicSettingsSection.vue @@ -49,22 +49,6 @@
-
-
-
默认智能体
-
- -
-
-