fix(lint): check alpha search builder writes

This commit is contained in:
siyuan
2026-07-16 00:36:38 +08:00
parent 695665cbc8
commit 72fada40f6
+11 -11
View File
@@ -303,20 +303,20 @@ func buildOpenAIAlphaSearchResponsesWebSearchBody(alphaBody []byte, model string
func openAIAlphaSearchResponsesWebSearchPrompt(alphaBody []byte) string {
var b strings.Builder
b.WriteString("Execute this Codex standalone web.run request for another model.\n")
b.WriteString("Use the hosted web_search tool when web/current information is needed.\n")
b.WriteString("Return concise source-backed results. Include titles, URLs, dates, and direct answers when available.\n")
_, _ = b.WriteString("Execute this Codex standalone web.run request for another model.\n")
_, _ = b.WriteString("Use the hosted web_search tool when web/current information is needed.\n")
_, _ = b.WriteString("Return concise source-backed results. Include titles, URLs, dates, and direct answers when available.\n")
if commands := strings.TrimSpace(gjson.GetBytes(alphaBody, "commands").Raw); commands != "" {
b.WriteString("\nCommands JSON:\n")
b.WriteString(truncateOpenAIAlphaSearchPromptJSON(commands, 12000))
_, _ = b.WriteString("\nCommands JSON:\n")
_, _ = b.WriteString(truncateOpenAIAlphaSearchPromptJSON(commands, 12000))
}
if settings := strings.TrimSpace(gjson.GetBytes(alphaBody, "settings").Raw); settings != "" {
b.WriteString("\n\nSearch settings JSON:\n")
b.WriteString(truncateOpenAIAlphaSearchPromptJSON(settings, 4000))
_, _ = b.WriteString("\n\nSearch settings JSON:\n")
_, _ = b.WriteString(truncateOpenAIAlphaSearchPromptJSON(settings, 4000))
}
if input := strings.TrimSpace(gjson.GetBytes(alphaBody, "input").Raw); input != "" {
b.WriteString("\n\nRecent conversation/input JSON:\n")
b.WriteString(truncateOpenAIAlphaSearchPromptJSON(input, 8000))
_, _ = b.WriteString("\n\nRecent conversation/input JSON:\n")
_, _ = b.WriteString(truncateOpenAIAlphaSearchPromptJSON(input, 8000))
}
if b.Len() == 0 {
return "Execute the requested web search and return concise source-backed results."
@@ -537,7 +537,7 @@ func parseOpenAIResponsesSSEForAlphaSearch(body []byte) (string, []any) {
continue
}
if delta, _ := event["delta"].(string); delta != "" && event["type"] == "response.output_text.delta" {
output.WriteString(delta)
_, _ = output.WriteString(delta)
}
if event["type"] == "response.completed" {
completedResponse = event["response"]
@@ -585,7 +585,7 @@ func extractOpenAIResponsesCompletedText(response any) string {
}
if contentMap["type"] == "output_text" {
if text, _ := contentMap["text"].(string); text != "" {
b.WriteString(text)
_, _ = b.WriteString(text)
}
}
}