From f0fad61bb2d8da70dfba916380b6f469ae44dffa Mon Sep 17 00:00:00 2001 From: Huarch Date: Fri, 3 Apr 2026 14:08:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=84=E8=AE=BE=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/chat/GlobalChatbox.utils.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/chat/GlobalChatbox.utils.ts b/src/components/chat/GlobalChatbox.utils.ts index 0bab75b..ff0b069 100644 --- a/src/components/chat/GlobalChatbox.utils.ts +++ b/src/components/chat/GlobalChatbox.utils.ts @@ -1,11 +1,13 @@ import type { PersistedChatState } from "./GlobalChatbox.types"; -export const createId = () => `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`; +export const createId = () => + `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`; export const CHAT_STORAGE_KEY = "tjwater_copilot_chat_state_v1"; -const THINK_TAG_ALIAS_PATTERN = /<\s*(\/?)\s*(thinking|reasoning|thought)\b[^>]*>/gi; +const THINK_TAG_ALIAS_PATTERN = + /<\s*(\/?)\s*(thinking|reasoning|thought)\b[^>]*>/gi; export const PRESET_PROMPTS = [ + "分析当前管网中的水力瓶颈管道,并给出改造建议。", "帮我分析当前管网压力异常点,并按风险等级排序。", - "基于当前状态,给出今天的巡检优先级和建议路线。", "帮我生成一份今日运行简报,包含问题、原因和建议。", ]; @@ -47,7 +49,10 @@ export const getInitialChatState = (): PersistedChatState => { } return { messages: parsed.messages, conversationId: parsed.conversationId }; } catch (error) { - console.error("[GlobalChatbox] Failed to read persisted chat state:", error); + console.error( + "[GlobalChatbox] Failed to read persisted chat state:", + error, + ); window.localStorage.removeItem(CHAT_STORAGE_KEY); return { messages: [], conversationId: undefined }; }