diff --git a/app/components/chat.tsx b/app/components/chat.tsx index c0d2580cd..65ff17bb0 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -25,6 +25,7 @@ import CancelIcon from "../icons/cancel.svg"; import StopIcon from "../icons/pause.svg"; import McpToolIcon from "../icons/tool.svg"; import { + BOT_HELLO, ChatMessage, createMessage, DEFAULT_TOPIC, @@ -1055,6 +1056,18 @@ function _Chat() { return session.mask.hideContext ? [] : session.mask.context.slice(); }, [session.mask.context, session.mask.hideContext]); + if ( + context.length === 0 && + session.messages.at(0)?.content !== BOT_HELLO.content + ) { + // Intentionally prevent adding BOT_HELLO message + // const copiedHello = Object.assign({}, BOT_HELLO); + // if (!accessStore.isAuthorized()) { + // copiedHello.content = Locale.Error.Unauthorized; + // } + // context.push(copiedHello); + } + // preview messages const renderMessages = useMemo(() => { return context.concat(session.messages as RenderMessage[]).concat( diff --git a/app/constant.ts b/app/constant.ts index 8c426d979..314dce107 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -329,8 +329,8 @@ You are an AI assistant with access to system tools. Your role is to help users 4. INTERACTION FLOW: A. When user makes a request: - - IMMEDIATELY use appropriate tool if available - - DO NOT ask if user wants you to use the tool + - Use an appropriate tool if available + - ASK if user wants you to use the tool - DO NOT just describe what you could do B. After receiving tool response: - Explain results clearly @@ -653,6 +653,17 @@ const siliconflowModels = [ let seq = 1000; // 内置的模型序号生成器从1000开始 export const DEFAULT_MODELS = [ + ...googleModels.map((name) => ({ + name, + available: true, + sorted: seq++, + provider: { + id: "google", + providerName: "Google", + providerType: "google", + sorted: 1, // Keep original provider sort order + }, + })), ...openaiModels.map((name) => ({ name, available: true, @@ -661,7 +672,7 @@ export const DEFAULT_MODELS = [ id: "openai", providerName: "OpenAI", providerType: "openai", - sorted: 1, // 这里是固定的,确保顺序与之前内置的版本一致 + sorted: 2, // 这里是固定的,确保顺序与之前内置的版本一致 }, })), ...openaiModels.map((name) => ({ @@ -672,17 +683,6 @@ export const DEFAULT_MODELS = [ id: "azure", providerName: "Azure", providerType: "azure", - sorted: 2, - }, - })), - ...googleModels.map((name) => ({ - name, - available: true, - sorted: seq++, - provider: { - id: "google", - providerName: "Google", - providerType: "google", sorted: 3, }, })),