From 9289adf7f560358d63ea604d39fa9e152e6bb1bd Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Thu, 8 Jan 2026 00:07:44 +0800 Subject: [PATCH 01/12] support gpt 5.2 --- internal/api/chat/list_supported_models_v2.go | 34 ++++++++++++++++++- .../services/toolkit/client/completion_v2.go | 8 +++++ .../_webapp/src/views/chat/footer/index.tsx | 2 +- .../chat/footer/toolbar/prompt-selection.tsx | 8 +++++ .../src/views/settings/setting-item-input.tsx | 2 +- .../views/settings/setting-item-select.tsx | 2 +- 6 files changed, 52 insertions(+), 4 deletions(-) diff --git a/internal/api/chat/list_supported_models_v2.go b/internal/api/chat/list_supported_models_v2.go index 7c37a7bd..5a7cfa4e 100644 --- a/internal/api/chat/list_supported_models_v2.go +++ b/internal/api/chat/list_supported_models_v2.go @@ -27,12 +27,20 @@ func (s *ChatServerV2) ListSupportedModels( var models []*chatv2.SupportedModel if strings.TrimSpace(settings.OpenAIAPIKey) == "" { models = []*chatv2.SupportedModel{ + { + Name: "GPT-5.1", + Slug: "openai/gpt-5.1", + TotalContext: 400000, + MaxOutput: 128000, + InputPrice: 125, // $1.25 + OutputPrice: 1000, // $10.00 + }, { Name: "GPT-4.1", Slug: "openai/gpt-4.1", TotalContext: 1050000, MaxOutput: 32800, - InputPrice: 200, + InputPrice: 200, // $2.00 OutputPrice: 800, }, { @@ -78,6 +86,30 @@ func (s *ChatServerV2) ListSupportedModels( } } else { models = []*chatv2.SupportedModel{ + { + Name: "GPT-5.2 Pro", + Slug: openai.ChatModelGPT5_2Pro, + TotalContext: 400000, + MaxOutput: 128000, + InputPrice: 2100, // $21.00 + OutputPrice: 16800, // $168.00 + }, + { + Name: "GPT-5.2", + Slug: openai.ChatModelGPT5_2, + TotalContext: 400000, + MaxOutput: 128000, + InputPrice: 175, // $1.75 + OutputPrice: 1400, // $14.00 + }, + { + Name: "GPT-5.1", + Slug: openai.ChatModelGPT5_1, + TotalContext: 400000, + MaxOutput: 128000, + InputPrice: 125, // $1.25 + OutputPrice: 1000, // $10.00 + }, { Name: "GPT-4.1", Slug: openai.ChatModelGPT4_1, diff --git a/internal/services/toolkit/client/completion_v2.go b/internal/services/toolkit/client/completion_v2.go index e7e5b7b2..79f15695 100644 --- a/internal/services/toolkit/client/completion_v2.go +++ b/internal/services/toolkit/client/completion_v2.go @@ -98,6 +98,14 @@ func (a *AIClientV2) ChatCompletionStreamV2(ctx context.Context, callbackStream } reasoning_content += s // fmt.Print(s) + } else if field, ok := delta.JSON.ExtraFields["reasoning"]; ok && field.Raw() != "null" { + var s string + err := json.Unmarshal([]byte(field.Raw()), &s) + if err != nil { + // fmt.Println(err) + } + reasoning_content += s + // fmt.Print(s) } else { if !is_answering { is_answering = true diff --git a/webapp/_webapp/src/views/chat/footer/index.tsx b/webapp/_webapp/src/views/chat/footer/index.tsx index 2f31f100..b5c8c389 100644 --- a/webapp/_webapp/src/views/chat/footer/index.tsx +++ b/webapp/_webapp/src/views/chat/footer/index.tsx @@ -121,7 +121,7 @@ export function PromptInput() { return (
{/* Only show one popup at a time - priority: prompts > actions > model selection */} - {prompts.length > 0 && } + {prompt.startsWith("/") && } {prompts.length === 0 && actions.length > 0 && } {prompts.length === 0 && actions.length === 0 && showModelSelection && ( diff --git a/webapp/_webapp/src/views/chat/footer/toolbar/prompt-selection.tsx b/webapp/_webapp/src/views/chat/footer/toolbar/prompt-selection.tsx index 79d7c286..a4f7774c 100644 --- a/webapp/_webapp/src/views/chat/footer/toolbar/prompt-selection.tsx +++ b/webapp/_webapp/src/views/chat/footer/toolbar/prompt-selection.tsx @@ -35,5 +35,13 @@ export function PromptSelection({ prompts }: PromptSelectionProps) { inputRef.current?.focus(); }, [setPrompt, inputRef]); + if (prompts.length === 0) { + return ( +
+
No prompts found
+
+ ); + } + return ; } diff --git a/webapp/_webapp/src/views/settings/setting-item-input.tsx b/webapp/_webapp/src/views/settings/setting-item-input.tsx index 54f2583e..634799d8 100644 --- a/webapp/_webapp/src/views/settings/setting-item-input.tsx +++ b/webapp/_webapp/src/views/settings/setting-item-input.tsx @@ -21,7 +21,7 @@ export const SettingItemInput = ({ }: SettingItemInputProps) => (
-

{label}

+

{label}

(
-

{label}

+

{label}

{description}