diff --git a/docs/prompt-compatibility.md b/docs/prompt-compatibility.md index 772d16c51..3063fc8f9 100644 --- a/docs/prompt-compatibility.md +++ b/docs/prompt-compatibility.md @@ -283,7 +283,7 @@ OpenAI 的文件上传现在不再是“只传文件本体”的通用路径, 兼容层现在只保留 `current_input_file` 这一种拆分方式;旧的 `history_split` 配置字段已移除,读取旧配置时会忽略它且不会再写回。 -- `current_input_file` 默认开启;它在统一 completion runtime 入口全局生效,并采用 inline-first 策略。runtime 会先按拆分前的完整 `PromptTokenText` 估算整体上下文 token;当整体上下文不超过 `current_input_file.inline_max_tokens`(默认 `30000`)时,请求保持完整 inline prompt,不上传生成的上下文或工具文件。只有最新 user turn 的纯文本长度达到 `current_input_file.min_chars`(默认 `0`)且整体上下文超过 inline 阈值时,runtime 才会把“完整上下文”合并进 `DS2API_HISTORY.txt` 上下文文件。文件内容会先经过各协议入口的标准化,再序列化成按轮次编号的 `DS2API_HISTORY.txt` 风格 transcript,带有 `# DS2API_HISTORY.txt` 标题和 `=== N. ROLE ===` 分段;如果当前请求带有可用 tools 且 tool choice 不是 `none`,runtime 还会上传 `DS2API_TOOLS.txt`,只承载本次请求的工具名称、描述和参数 schema。live prompt 中则会给出一个 continuation 语气的 user 消息,引导模型从 `DS2API_HISTORY.txt` 的最新状态继续推进,并直接回答最新请求;如果有 `DS2API_TOOLS.txt`,live prompt 会额外要求模型把该文件视为可调用工具和 schema 的权威来源,避免把任务拉回起点,也避免把大段 schema 再次内联到 prompt。 +- `current_input_file` 默认开启;它在统一 completion runtime 入口全局生效,并采用 inline-first 策略。runtime 会先按拆分前的完整 `PromptTokenText` 估算整体上下文 token;当整体上下文不超过 `current_input_file.inline_max_tokens`(默认 `30000`)时,请求保持完整 inline prompt,不上传生成的上下文或工具文件。只有最新 user turn 的纯文本长度达到 `current_input_file.min_chars`(默认 `0`)且整体上下文超过 inline 阈值时,runtime 才会把“完整上下文”合并进 `DS2API_HISTORY.txt` 上下文文件。文件内容会先经过各协议入口的标准化,再序列化成按轮次编号的 `DS2API_HISTORY.txt` 风格 transcript,带有 `# DS2API_HISTORY.txt` 标题和 `=== N. ROLE ===` 分段;如果当前请求带有可用 tools 且 tool choice 不是 `none`,runtime 还会上传 `DS2API_TOOLS.txt`,只承载本次请求的工具名称、描述和参数 schema。live prompt 中则会给出一个中性的 continuation user 消息,要求模型使用附加 conversation context 作为当前工作状态并直接回答最新请求;如果有工具文件,live prompt 会额外说明附加 tool reference 是本轮可用工具和 schema 的权威来源,避免把任务拉回起点,也避免把大段 schema 再次内联到 prompt。 - 如果 `current_input_file.enabled=false`,请求会直接透传,不上传任何拆分上下文文件。 - 对客户端回包里的上下文 token 统计,短上下文 inline 路径直接按完整 prompt 计数;触发 `current_input_file` 后 live prompt 被缩短时,仍会沿用**拆分前的完整 prompt 语义**做计数,而不是按缩短后的占位 prompt 计算;否则会把真实上下文显著算小。 - 如果空输出重试最终需要切换托管账号,runtime 会在新账号下重新上传已生成的 `DS2API_HISTORY.txt` 和可选 `DS2API_TOOLS.txt`,再用新的 generated `file_id` 重建 completion payload;客户端原有文件引用会保留在 generated 文件之后。这样可以避免把旧账号不可见的 generated file_id 带到新账号请求里。 @@ -389,7 +389,7 @@ Parameters: {"type":"object",...} ```json { - "prompt": "<|begin▁of▁sentence|><|System|>原 system / developer\n\nAvailable tool descriptions and parameter schemas are attached in DS2API_TOOLS.txt...\n\nTOOL CALL FORMAT: ...<|end▁of▁instructions|><|User|>Continue from the latest state in the attached DS2API_HISTORY.txt context. Treat it as the current working state and answer the latest user request directly. Available tool descriptions and parameter schemas are attached in DS2API_TOOLS.txt; use only those tools and follow the tool-call format rules in this prompt.<|Assistant|>", + "prompt": "<|begin▁of▁sentence|><|System|>原 system / developer\n\nAvailable tool descriptions and parameter schemas are attached in a tool reference...\n\nTOOL CALL FORMAT: ...<|end▁of▁instructions|><|User|>Use the attached conversation context as the current working state. Answer the latest user request directly. The attached tool reference lists the available tools and parameter schemas for this request; use only those tools and follow the tool-call format rules in this prompt.<|Assistant|>", "ref_file_ids": [ "file-current-input-history", "file-current-input-tools", diff --git a/internal/completionruntime/nonstream_test.go b/internal/completionruntime/nonstream_test.go index f6694561d..e2c678960 100644 --- a/internal/completionruntime/nonstream_test.go +++ b/internal/completionruntime/nonstream_test.go @@ -342,7 +342,7 @@ func TestStartCompletionAppliesCurrentInputFileGlobally(t *testing.T) { t.Fatalf("expected uploaded file id in ref_file_ids, got %#v", ds.payloads[0]["ref_file_ids"]) } prompt, _ := ds.payloads[0]["prompt"].(string) - if !strings.Contains(prompt, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(prompt, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation prompt, got %q", prompt) } if !start.Request.CurrentInputFileApplied || !strings.Contains(start.Request.PromptTokenText, "# DS2API_HISTORY.txt") { diff --git a/internal/httpapi/claude/current_input_file_test.go b/internal/httpapi/claude/current_input_file_test.go index d83455ac3..116dd894d 100644 --- a/internal/httpapi/claude/current_input_file_test.go +++ b/internal/httpapi/claude/current_input_file_test.go @@ -141,7 +141,7 @@ func TestClaudeDirectAppliesCurrentInputFile(t *testing.T) { t.Fatalf("expected uploaded history ref id, got %#v", ds.payload["ref_file_ids"]) } prompt, _ := ds.payload["prompt"].(string) - if !strings.Contains(prompt, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(prompt, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation prompt, got %q", prompt) } snapshot, err := historyStore.Snapshot() @@ -158,7 +158,7 @@ func TestClaudeDirectAppliesCurrentInputFile(t *testing.T) { if full.HistoryText != string(ds.uploads[0].Data) { t.Fatalf("expected uploaded current input file to be persisted in history text") } - if len(full.Messages) != 1 || !strings.Contains(full.Messages[0].Content, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if len(full.Messages) != 1 || !strings.Contains(full.Messages[0].Content, "Use the attached conversation context as the current working state.") { t.Fatalf("expected persisted message to match upstream continuation prompt, got %#v", full.Messages) } } @@ -206,8 +206,8 @@ func TestClaudeCurrentInputFileUploadsToolsSeparately(t *testing.T) { t.Fatalf("expected history and tools ref ids first, got %#v", ds.payload["ref_file_ids"]) } prompt, _ := ds.payload["prompt"].(string) - if !strings.Contains(prompt, "DS2API_TOOLS.txt") || !strings.Contains(prompt, "TOOL CALL FORMAT") { - t.Fatalf("expected live prompt to reference tools file and retain format instructions, got %q", prompt) + if !strings.Contains(prompt, "tool reference") || !strings.Contains(prompt, "TOOL CALL FORMAT") { + t.Fatalf("expected live prompt to reference tool reference and retain format instructions, got %q", prompt) } if strings.Contains(prompt, "Description: search docs") { t.Fatalf("live prompt should not inline tool descriptions, got %q", prompt) diff --git a/internal/httpapi/gemini/handler_test.go b/internal/httpapi/gemini/handler_test.go index cbba7435b..768194b74 100644 --- a/internal/httpapi/gemini/handler_test.go +++ b/internal/httpapi/gemini/handler_test.go @@ -179,7 +179,7 @@ func TestGeminiDirectAppliesCurrentInputFile(t *testing.T) { t.Fatalf("expected uploaded history ref id, got %#v", ds.payloads[0]["ref_file_ids"]) } prompt, _ := ds.payloads[0]["prompt"].(string) - if !strings.Contains(prompt, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(prompt, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation prompt, got %q", prompt) } snapshot, err := historyStore.Snapshot() @@ -202,7 +202,7 @@ func TestGeminiDirectAppliesCurrentInputFile(t *testing.T) { if full.HistoryText != string(ds.uploadCalls[0].Data) { t.Fatalf("expected uploaded current input file to be persisted in history text") } - if len(full.Messages) != 1 || !strings.Contains(full.Messages[0].Content, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if len(full.Messages) != 1 || !strings.Contains(full.Messages[0].Content, "Use the attached conversation context as the current working state.") { t.Fatalf("expected persisted message to match upstream continuation prompt, got %#v", full.Messages) } } @@ -250,8 +250,8 @@ func TestGeminiCurrentInputFileUploadsToolsSeparately(t *testing.T) { t.Fatalf("expected history and tools ref ids first, got %#v", ds.payloads[0]["ref_file_ids"]) } prompt, _ := ds.payloads[0]["prompt"].(string) - if !strings.Contains(prompt, "DS2API_TOOLS.txt") || !strings.Contains(prompt, "TOOL CALL FORMAT") { - t.Fatalf("expected live prompt to reference tools file and retain format instructions, got %q", prompt) + if !strings.Contains(prompt, "tool reference") || !strings.Contains(prompt, "TOOL CALL FORMAT") { + t.Fatalf("expected live prompt to reference tool reference and retain format instructions, got %q", prompt) } if strings.Contains(prompt, "Description: eval") { t.Fatalf("live prompt should not inline tool descriptions, got %q", prompt) diff --git a/internal/httpapi/openai/chat/chat_history_test.go b/internal/httpapi/openai/chat/chat_history_test.go index ca9a7725f..bc4bc5b5d 100644 --- a/internal/httpapi/openai/chat/chat_history_test.go +++ b/internal/httpapi/openai/chat/chat_history_test.go @@ -400,7 +400,7 @@ func TestChatCompletionsCurrentInputFilePersistsNeutralPrompt(t *testing.T) { if len(full.Messages) != 1 { t.Fatalf("expected continuation prompt to be the only persisted message, got %#v", full.Messages) } - if !strings.Contains(full.Messages[0].Content, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(full.Messages[0].Content, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation prompt to be persisted, got %#v", full.Messages[0]) } } diff --git a/internal/httpapi/openai/chat/vercel_prepare_test.go b/internal/httpapi/openai/chat/vercel_prepare_test.go index 08433004b..abddadf77 100644 --- a/internal/httpapi/openai/chat/vercel_prepare_test.go +++ b/internal/httpapi/openai/chat/vercel_prepare_test.go @@ -147,7 +147,7 @@ func TestHandleVercelStreamPrepareAppliesCurrentInputFile(t *testing.T) { t.Fatalf("expected payload object, got %#v", body["payload"]) } promptText, _ := payload["prompt"].(string) - if !strings.Contains(promptText, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(promptText, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation prompt, got %s", promptText) } if strings.Contains(promptText, "first user turn") || strings.Contains(promptText, "latest user turn") { @@ -218,8 +218,8 @@ func TestHandleVercelStreamPrepareUploadsToolsSeparately(t *testing.T) { payload, _ := body["payload"].(map[string]any) payloadPrompt, _ := payload["prompt"].(string) for label, promptText := range map[string]string{"final_prompt": finalPrompt, "payload.prompt": payloadPrompt} { - if !strings.Contains(promptText, "DS2API_TOOLS.txt") || !strings.Contains(promptText, "TOOL CALL FORMAT") { - t.Fatalf("expected %s to reference tools file and retain tool instructions, got %q", label, promptText) + if !strings.Contains(promptText, "tool reference") || !strings.Contains(promptText, "TOOL CALL FORMAT") { + t.Fatalf("expected %s to reference tool reference and retain tool instructions, got %q", label, promptText) } if strings.Contains(promptText, "Description: search docs") { t.Fatalf("expected %s not to inline tool descriptions, got %q", label, promptText) @@ -418,7 +418,7 @@ func TestHandleVercelStreamSwitchReuploadsCurrentInputFile(t *testing.T) { RequestedModel: "deepseek-v4-flash", ResolvedModel: "deepseek-v4-flash", ResponseModel: "deepseek-v4-flash", - FinalPrompt: "Continue from the latest state in the attached DS2API_HISTORY.txt context. Available tool descriptions and parameter schemas are attached in DS2API_TOOLS.txt; use only those tools and follow the tool-call format rules in this prompt.", + FinalPrompt: "Use the attached conversation context as the current working state. The attached tool reference lists the available tools and parameter schemas for this request; use only those tools and follow the tool-call format rules in this prompt.", PromptTokenText: "# DS2API_HISTORY.txt\n\n=== 1. USER ===\nhello\n\n# DS2API_TOOLS.txt\nAvailable tool descriptions and parameter schemas for this request.\n\nYou have access to these tools:\n\nTool: search\nDescription: search docs\nParameters: {\"type\":\"object\"}\n", HistoryText: "# DS2API_HISTORY.txt\n\n=== 1. USER ===\nhello\n", CurrentInputFileApplied: true, @@ -469,8 +469,8 @@ func TestHandleVercelStreamSwitchReuploadsCurrentInputFile(t *testing.T) { t.Fatalf("expected reuploaded current input refs plus client ref, got %#v", payload["ref_file_ids"]) } promptText, _ := payload["prompt"].(string) - if !strings.Contains(promptText, "DS2API_TOOLS.txt") { - t.Fatalf("expected switched payload prompt to retain tools file reference, got %q", promptText) + if !strings.Contains(promptText, "tool reference") { + t.Fatalf("expected switched payload prompt to retain tool reference, got %q", promptText) } ok, _, releasedSessionID, pendingCleanups := h.releaseStreamLease(leaseID) if !ok { @@ -520,7 +520,7 @@ func TestHandleVercelStreamSwitchReleaseCleansOldSessionAfterReuploadFailure(t * RequestedModel: "deepseek-v4-flash", ResolvedModel: "deepseek-v4-flash", ResponseModel: "deepseek-v4-flash", - FinalPrompt: "Continue from the latest state in the attached DS2API_HISTORY.txt context.", + FinalPrompt: "Use the attached conversation context as the current working state.", HistoryText: "# DS2API_HISTORY.txt\n\n=== 1. USER ===\nhello\n", CurrentInputFileApplied: true, CurrentInputFileID: "file-old", diff --git a/internal/httpapi/openai/history/current_input_cache_test.go b/internal/httpapi/openai/history/current_input_cache_test.go index 890c7072e..5ebb94db4 100644 --- a/internal/httpapi/openai/history/current_input_cache_test.go +++ b/internal/httpapi/openai/history/current_input_cache_test.go @@ -157,8 +157,8 @@ func TestApplyCurrentInputFileGoldenTranscriptStability(t *testing.T) { if !strings.HasPrefix(out.PromptTokenText, wantHistory+"\n"+wantTools+"\n") { t.Fatalf("prompt token text should start with history, tools, prompt in order, got %q", out.PromptTokenText) } - if !strings.Contains(out.FinalPrompt, "DS2API_TOOLS.txt") || !strings.Contains(out.FinalPrompt, "TOOL CALL FORMAT") { - t.Fatalf("final prompt should reference tools file and retain format instructions, got %q", out.FinalPrompt) + if !strings.Contains(out.FinalPrompt, "tool reference") || !strings.Contains(out.FinalPrompt, "TOOL CALL FORMAT") { + t.Fatalf("final prompt should reference tool reference and retain format instructions, got %q", out.FinalPrompt) } if strings.Contains(out.FinalPrompt, "Description: Search docs") { t.Fatalf("final prompt should not inline tool descriptions, got %q", out.FinalPrompt) diff --git a/internal/httpapi/openai/history/current_input_file.go b/internal/httpapi/openai/history/current_input_file.go index f0b526097..14c24abfb 100644 --- a/internal/httpapi/openai/history/current_input_file.go +++ b/internal/httpapi/openai/history/current_input_file.go @@ -292,9 +292,9 @@ func latestUserInputForFile(messages []any) (int, string) { } func currentInputFilePrompt(hasToolsFile bool) string { - prompt := "Continue from the latest state in the attached DS2API_HISTORY.txt context. Treat it as the current working state and answer the latest user request directly." + prompt := "Use the attached conversation context as the current working state. Answer the latest user request directly." if hasToolsFile { - prompt += " Available tool descriptions and parameter schemas are attached in DS2API_TOOLS.txt; use only those tools and follow the tool-call format rules in this prompt." + prompt += " The attached tool reference lists the available tools and parameter schemas for this request; use only those tools and follow the tool-call format rules in this prompt." } return prompt } diff --git a/internal/httpapi/openai/history_split_test.go b/internal/httpapi/openai/history_split_test.go index b10313e61..bbcb4ecee 100644 --- a/internal/httpapi/openai/history_split_test.go +++ b/internal/httpapi/openai/history_split_test.go @@ -271,7 +271,7 @@ func TestApplyCurrentInputFileUploadsFirstTurnWithNumberedHistoryTranscript(t *t if strings.Contains(out.FinalPrompt, "CURRENT_USER_INPUT.txt") || strings.Contains(out.FinalPrompt, "Read that file") { t.Fatalf("expected live prompt not to instruct file reads, got %s", out.FinalPrompt) } - if !strings.Contains(out.FinalPrompt, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(out.FinalPrompt, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation-oriented prompt in live prompt, got %s", out.FinalPrompt) } if len(out.RefFileIDs) != 1 || out.RefFileIDs[0] != "file-inline-1" { @@ -322,7 +322,7 @@ func TestApplyCurrentInputFilePreservesFullContextPromptForTokenCounting(t *test if !strings.Contains(out.PromptTokenText, "# DS2API_HISTORY.txt") || !strings.Contains(out.PromptTokenText, "=== 1. SYSTEM ===") { t.Fatalf("expected prompt token text to include numbered history transcript, got %q", out.PromptTokenText) } - if !strings.Contains(out.PromptTokenText, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(out.PromptTokenText, "Use the attached conversation context as the current working state.") { t.Fatalf("expected prompt token text to also include continuation prompt, got %q", out.PromptTokenText) } if strings.Contains(out.FinalPrompt, "first user turn") || strings.Contains(out.FinalPrompt, "latest user turn") { @@ -375,7 +375,7 @@ func TestApplyCurrentInputFileUploadsFullContextFile(t *testing.T) { if strings.Contains(out.FinalPrompt, "first user turn") || strings.Contains(out.FinalPrompt, "latest user turn") || strings.Contains(out.FinalPrompt, "CURRENT_USER_INPUT.txt") || strings.Contains(out.FinalPrompt, "Read that file") { t.Fatalf("expected live prompt to use only a continuation instruction, got %s", out.FinalPrompt) } - if !strings.Contains(out.FinalPrompt, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(out.FinalPrompt, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation-oriented prompt in live prompt, got %s", out.FinalPrompt) } } @@ -460,7 +460,7 @@ func TestChatCompletionsCurrentInputFileUploadsContextAndKeepsNeutralPrompt(t *t t.Fatal("expected completion payload to be captured") } promptText, _ := ds.completionReq["prompt"].(string) - if !strings.Contains(promptText, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(promptText, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation-oriented prompt, got %s", promptText) } if strings.Contains(promptText, "first user turn") || strings.Contains(promptText, "latest user turn") { @@ -519,7 +519,7 @@ func TestResponsesCurrentInputFileUploadsContextAndKeepsNeutralPrompt(t *testing t.Fatal("expected completion payload to be captured") } promptText, _ := ds.completionReq["prompt"].(string) - if !strings.Contains(promptText, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(promptText, "Use the attached conversation context as the current working state.") { t.Fatalf("expected continuation-oriented prompt, got %s", promptText) } if strings.Contains(promptText, "first user turn") || strings.Contains(promptText, "latest user turn") { @@ -588,8 +588,8 @@ func TestResponsesCurrentInputFileUploadsToolsSeparately(t *testing.T) { t.Fatalf("expected tools transcript to include schema, got %q", toolsText) } promptText, _ := ds.completionReq["prompt"].(string) - if !strings.Contains(promptText, "DS2API_TOOLS.txt") || !strings.Contains(promptText, "TOOL CALL FORMAT") { - t.Fatalf("expected live prompt to reference tools file and retain format instructions, got %q", promptText) + if !strings.Contains(promptText, "tool reference") || !strings.Contains(promptText, "TOOL CALL FORMAT") { + t.Fatalf("expected live prompt to reference tool reference and retain format instructions, got %q", promptText) } if strings.Contains(promptText, "Description: search docs") { t.Fatalf("live prompt should not inline tool descriptions, got %q", promptText) @@ -728,7 +728,7 @@ func TestCurrentInputFileWorksAcrossAutoDeleteModes(t *testing.T) { t.Fatalf("expected completion payload for mode=%s", mode) } promptText, _ := ds.completionReq["prompt"].(string) - if !strings.Contains(promptText, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") || strings.Contains(promptText, "first user turn") || strings.Contains(promptText, "latest user turn") { + if !strings.Contains(promptText, "Use the attached conversation context as the current working state.") || strings.Contains(promptText, "first user turn") || strings.Contains(promptText, "latest user turn") { t.Fatalf("unexpected prompt for mode=%s: %s", mode, promptText) } }) diff --git a/internal/httpapi/openai/responses/responses_history_test.go b/internal/httpapi/openai/responses/responses_history_test.go index f735c5aa0..fd9f2d874 100644 --- a/internal/httpapi/openai/responses/responses_history_test.go +++ b/internal/httpapi/openai/responses/responses_history_test.go @@ -95,7 +95,7 @@ func TestResponsesRecordsResponseHistory(t *testing.T) { if item.Surface != "openai.responses" { t.Fatalf("unexpected surface: %q", item.Surface) } - if !strings.Contains(item.UserInput, "Continue from the latest state in the attached DS2API_HISTORY.txt context.") { + if !strings.Contains(item.UserInput, "Use the attached conversation context as the current working state.") { t.Fatalf("unexpected user input: %q", item.UserInput) } if !strings.Contains(item.HistoryText, "hello responses") { diff --git a/internal/promptcompat/prompt_build_test.go b/internal/promptcompat/prompt_build_test.go index a739c8e05..275c132a0 100644 --- a/internal/promptcompat/prompt_build_test.go +++ b/internal/promptcompat/prompt_build_test.go @@ -193,8 +193,8 @@ func TestBuildOpenAIPromptWithToolInstructionsOnlyOmitsSchemas(t *testing.T) { if len(toolNames) != 1 || toolNames[0] != "search" { t.Fatalf("unexpected tool names: %#v", toolNames) } - if !strings.Contains(finalPrompt, "DS2API_TOOLS.txt") { - t.Fatalf("instructions-only prompt should reference tools file, got %q", finalPrompt) + if !strings.Contains(finalPrompt, "tool reference") { + t.Fatalf("instructions-only prompt should reference attached tool reference, got %q", finalPrompt) } if !strings.Contains(finalPrompt, "TOOL CALL FORMAT") || !strings.Contains(finalPrompt, "<|DSML|tool_calls>") { t.Fatalf("instructions-only prompt should retain tool-call format rules, got %q", finalPrompt) diff --git a/internal/promptcompat/tool_prompt.go b/internal/promptcompat/tool_prompt.go index 4d840761b..eaaef3113 100644 --- a/internal/promptcompat/tool_prompt.go +++ b/internal/promptcompat/tool_prompt.go @@ -40,7 +40,7 @@ func injectToolPromptWithDescriptions(messages []map[string]any, tools []any, po if includeDescriptions && parts.Descriptions != "" { toolPrompt = parts.Descriptions + "\n\n" + toolPrompt } else if !includeDescriptions && parts.Descriptions != "" { - toolPrompt = "Available tool descriptions and parameter schemas are attached in DS2API_TOOLS.txt. Treat DS2API_TOOLS.txt as the authoritative list of callable tools and schemas; use only tools and parameters listed there.\n\n" + toolPrompt + toolPrompt = "Available tool descriptions and parameter schemas are attached in a tool reference. Treat the attached tool reference as the authoritative list of callable tools and schemas; use only tools and parameters listed there.\n\n" + toolPrompt } for i := range messages { diff --git a/tests/node/chat-history-utils.test.js b/tests/node/chat-history-utils.test.js index 05bf2f09e..defe2c241 100644 --- a/tests/node/chat-history-utils.test.js +++ b/tests/node/chat-history-utils.test.js @@ -15,7 +15,7 @@ test('chat history strict parser merges current input file placeholder', async ( const item = { messages: [{ role: 'user', - content: 'Continue from the latest state in the attached DS2API_HISTORY.txt context. Treat it as the current working state and answer the latest user request directly.', + content: 'Use the attached conversation context as the current working state. Answer the latest user request directly.', }], history_text: [ '<|begin▁of▁sentence|>', @@ -67,7 +67,7 @@ test('chat history transcript parser replaces current input file placeholder', a const item = { messages: [{ role: 'user', - content: 'Continue from the latest state in the attached DS2API_HISTORY.txt context. Treat it as the current working state and answer the latest user request directly.', + content: 'Use the attached conversation context as the current working state. Answer the latest user request directly.', }], history_text: [ '# DS2API_HISTORY.txt', diff --git a/webui/src/features/chatHistory/chatHistoryUtils.js b/webui/src/features/chatHistory/chatHistoryUtils.js index 6359c39e0..097fc3368 100644 --- a/webui/src/features/chatHistory/chatHistoryUtils.js +++ b/webui/src/features/chatHistory/chatHistoryUtils.js @@ -11,8 +11,9 @@ const TOOL_MARKER = '<|Tool|>' const END_INSTRUCTIONS_MARKER = '<|end▁of▁instructions|>' const END_SENTENCE_MARKER = '<|end▁of▁sentence|>' const END_TOOL_RESULTS_MARKER = '<|end▁of▁toolresults|>' -const CURRENT_INPUT_FILE_PROMPT = 'Continue from the latest state in the attached DS2API_HISTORY.txt context. Treat it as the current working state and answer the latest user request directly.' +const CURRENT_INPUT_FILE_PROMPT = 'Use the attached conversation context as the current working state. Answer the latest user request directly.' const LEGACY_CURRENT_INPUT_FILE_PROMPTS = new Set([ + 'Continue from the latest state in the attached DS2API_HISTORY.txt context. Treat it as the current working state and answer the latest user request directly.', 'The current request and prior conversation context have already been provided. Answer the latest user request directly.', ]) const HISTORY_TRANSCRIPT_TITLE = '# DS2API_HISTORY.txt'