From b96a892ff0ca865ff7ad3c40102efd2223b31a9c Mon Sep 17 00:00:00 2001 From: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 15:09:42 +0800 Subject: [PATCH 1/4] fix: encode kind-2 interaction models as model targets in CreateInteraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Google migrated some accounts' gemini-4 models to the Interactions backend, setting catalog field79 to [background=1, kind=2]. The website creates these via CreateInteraction with the target at index 17 as ["models/X", genConfig] (same shape as CreateInteractionStream), then streams via GetInteractionStream. AIS encoded kind-2 models into the index-18 agent target, so upstream rejected with 'refers to a model, but was provided in the agent field'. - models.go: record field79 kind==2 as interaction_model capability (routing unchanged: background=1 still selects the task path) - interaction.go: EncodeCreateInteractionRequest branches on kind — kind-2 models encode the model target at index 17 with a generation config identical to the stream path; kind-1 agents keep the index-18 agent target - emit the field-53 video output format only for video-capable models - map interaction final state 6 (incomplete) to a length finish instead of a protocol error Verified on a migrated account against the website's own request capture and live traffic: gemini-4 family single/multi-turn all 200. --- internal/aistudio/interaction.go | 58 +++++++++++++++++++++++++++++--- internal/aistudio/models.go | 2 ++ 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/internal/aistudio/interaction.go b/internal/aistudio/interaction.go index 71c91b6e..e3e15198 100644 --- a/internal/aistudio/interaction.go +++ b/internal/aistudio/interaction.go @@ -105,7 +105,7 @@ func EncodeCreateInteractionStreamRequest(request GenerateRequest, defaults Gene // field 54 输出格式:视频格式 field 4 宽高比、field 5 时长、field 6 分辨率,编辑任务不带输出格式 if task == interactionVideoTasks["edit"] { interaction = interaction[:27] - } else { + } else if defaults.VideoResolution != "" { interaction[53] = []any{[]any{[]any{nil, nil, nil, video}}} } body, proofAt, _ := marshalWAAArray([]any{int64(1), int64(1), nil, interaction, nil, int64(1)}, 5) @@ -523,8 +523,11 @@ func decodeInteractionEvent(method string, raw json.RawMessage, emit func(Event) if err != nil { return false, withMethod(err, method) } + finishReason := "stop" switch status { case 3: + case 6: + finishReason = "length" case 4: return false, &RPCError{Method: method, StatusCode: http.StatusBadGateway, Message: "interaction failed"} case 5: @@ -547,7 +550,7 @@ func decodeInteractionEvent(method string, raw json.RawMessage, emit func(Event) return false, withMethod(err, method) } } - return true, emit(Event{Kind: EventFinish, FinishReason: "stop", EnvironmentID: environmentID}) + return true, emit(Event{Kind: EventFinish, FinishReason: finishReason, EnvironmentID: environmentID}) } // decodeInteractionDelta 解码 content delta:field 1 文本、field 2 图片、field 3 音频、field 4 文档、field 5 视频、field 6 思考摘要、field 7 思考签名、field 10 引用 @@ -804,8 +807,12 @@ func trimWireNil(values []any) []any { return values } -// EncodeCreateInteractionRequest 编码官网后台 agent 的 CreateInteraction 请求并返回参与 WAA 绑定的文本内容 -func EncodeCreateInteractionRequest(request GenerateRequest, model Model) ([]byte, int, []Content, error) { +// EncodeCreateInteractionRequest 编码官网后台 interaction 的 CreateInteraction 请求并返回参与 WAA 绑定的文本内容;目标是 agent 或 kind=2 模型 +func EncodeCreateInteractionRequest(request GenerateRequest, model Model, defaults GenerationDefaults) ([]byte, int, []Content, error) { + // field 79 kind=2 的模型不是 agent:field 18 携带模型目标与 generation config,与官网一致 + if model.Capabilities["interaction_model"] { + return encodeModelInteractionTarget(request, defaults) + } agent := strings.TrimPrefix(strings.TrimSpace(request.Model), "models/") // kind 是该 agent 的 agent_config 类型:带默认模型的 agent 为 antigravity,其余为 deep-research kind := "deep-research" @@ -862,6 +869,47 @@ func EncodeCreateInteractionRequest(request GenerateRequest, model Model) ([]byt return body, proofAt, binding, nil } +// encodeModelInteractionTarget 编码 kind=2 模型的 CreateInteraction 请求:field 18 为模型目标与 generation config,generation config 与 CreateInteractionStream 同构 +func encodeModelInteractionTarget(request GenerateRequest, defaults GenerationDefaults) ([]byte, int, []Content, error) { + steps, binding, _, err := encodeInteractionSteps(request.Contents) + if err != nil { + return nil, 0, nil, err + } + level, err := interactionThinkingLevel(request.Config, defaults) + if err != nil { + return nil, 0, nil, err + } + maxOutput := defaults.MaxOutputTokens + if request.Config.MaxOutputTokens != nil { + maxOutput = *request.Config.MaxOutputTokens + } + if maxOutput > defaults.MaxOutputTokens { + maxOutput = defaults.MaxOutputTokens + } + if maxOutput <= 0 { + return nil, 0, nil, fmt.Errorf("max output tokens %d 超出模型范围 1-%d", maxOutput, defaults.MaxOutputTokens) + } + config := make([]any, 8) + if level != 0 { + config[5] = level + } + config[6] = int64(1) + config[7] = maxOutput + interaction := make([]any, 27) + if system := strings.TrimSpace(SystemText(request.System)); system != "" { + interaction[6] = system + } + // field 17 为续接的上一轮 interaction ID + if request.PreviousInteractionID != "" { + interaction[16] = request.PreviousInteractionID + } + // field 18 为模型目标:field 1 为模型名、field 2 为 generation config + interaction[17] = []any{wireModelName(request.Model), config} + interaction[26] = []any{steps} + body, proofAt, _ := marshalWAAArray([]any{nil, int64(1), int64(1), interaction, nil, int64(1)}, 5) + return body, proofAt, binding, nil +} + // EncodeGetInteractionStreamRequest 编码按 interaction ID 读取后台任务增量与终态的请求 func EncodeGetInteractionStreamRequest(id string, model string) ([]byte, int, error) { return marshalWAAArray([]any{id, int64(1), nil, nil, nil, int64(1), wireModelName(model)}, 5) @@ -887,7 +935,7 @@ func (c *Client) generateInteractionTask(ctx context.Context, request GenerateRe reason = "该模型使用 CreateInteraction 后台任务,收集完成后返回" } reportUpstreamMode(ctx, "GetInteractionStream", "stream", 0, reason) - body, proofAt, binding, err := EncodeCreateInteractionRequest(request, entry.model) + body, proofAt, binding, err := EncodeCreateInteractionRequest(request, entry.model, entry.defaults) if err != nil { return nil, fmt.Errorf("%w: %v", ErrInvalidArgument, err) } diff --git a/internal/aistudio/models.go b/internal/aistudio/models.go index 9e55dd76..91b04480 100644 --- a/internal/aistudio/models.go +++ b/internal/aistudio/models.go @@ -290,6 +290,8 @@ func decodeModelRow(raw json.RawMessage, rowIndex int) (modelEntry, error) { } // field 4 为 2 且不是后台任务的模型经 CreateInteractionStream 生成,与官网一样以内联数据发送图片 model.Capabilities["interaction_stream"] = kind == 2 && !model.Capabilities["interaction_task"] + // field 4 为 2 表示 interaction 目标是模型而非 agent,后台任务的 CreateInteraction 在 field 17 携带模型目标 + model.Capabilities["interaction_model"] = kind == 2 if value := rawAt(interaction, 5); !isJSONNull(value) { agentModel, err := rawString(value, path+"[78][5]", raw) if err != nil { From d79890dcb0d247d0c19b4cba54d3df8ce3a856de Mon Sep 17 00:00:00 2001 From: likeravine233 Date: Tue, 24 Nov 2026 15:46:21 +0800 Subject: [PATCH 2/4] fix: decode requires_action final state and emit tool calls Interaction final status 2 (requires_action) ends the interaction after a function call. Decode call contents from the interaction steps and emit EventToolCall events with a tool_calls finish reason instead of failing with an unrecognized final state. --- internal/aistudio/interaction.go | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/internal/aistudio/interaction.go b/internal/aistudio/interaction.go index e3e15198..dbd23d8e 100644 --- a/internal/aistudio/interaction.go +++ b/internal/aistudio/interaction.go @@ -525,6 +525,8 @@ func decodeInteractionEvent(method string, raw json.RawMessage, emit func(Event) } finishReason := "stop" switch status { + case 2: + finishReason = "tool_calls" case 3: case 6: finishReason = "length" @@ -535,6 +537,11 @@ func decodeInteractionEvent(method string, raw json.RawMessage, emit func(Event) default: return false, &ProtocolEvidenceError{Method: method, Path: "$event[19][0][1]", Detail: fmt.Sprintf("未识别的最终状态 %d", status), Raw: cloneRaw(raw)} } + if status == 2 { + if err := decodeInteractionCalls(method, interaction, raw, emit); err != nil { + return false, err + } + } if usage := rawAt(interaction, 12); !isJSONNull(usage) { decoded, err := decodeInteractionUsage(method, usage, raw) if err != nil { @@ -553,6 +560,64 @@ func decodeInteractionEvent(method string, raw json.RawMessage, emit func(Event) return true, emit(Event{Kind: EventFinish, FinishReason: finishReason, EnvironmentID: environmentID}) } +// decodeInteractionCalls 从 requires_action 终态的 interaction 提取函数调用:调用以 content 形式出现在 step 列表(索引 26)的模型 step 内,content 索引 10 为 ["",,""?];step 列表缺失时回退扫描整个 interaction +func decodeInteractionCalls(method string, interaction []json.RawMessage, raw json.RawMessage, emit func(Event) error) error { + var root any + if steps := rawAt(interaction, 26); !isJSONNull(steps) { + if err := json.Unmarshal(steps, &root); err != nil { + return withMethod(err, method) + } + } else { + data, err := json.Marshal(interaction) + if err != nil { + return withMethod(err, method) + } + if err := json.Unmarshal(data, &root); err != nil { + return withMethod(err, method) + } + } + var calls []json.RawMessage + scanInteractionCalls(root, &calls, 0) + emitted := make(map[string]bool, len(calls)) + for index, callRaw := range calls { + call, err := decodeFunctionCall(callRaw, fmt.Sprintf("$event[19][0] call[%d]", index), raw) + if err != nil { + continue + } + if emitted[string(callRaw)] { + continue + } + emitted[string(callRaw)] = true + if err := emit(Event{Kind: EventToolCall, FunctionCall: &call}); err != nil { + return err + } + } + return nil +} + +// scanInteractionCalls 递归收集形如函数调用的 content:数组索引 10 为以字符串(名称)开头的数组 +func scanInteractionCalls(node any, calls *[]json.RawMessage, depth int) { + if depth > 12 { + return + } + arr, ok := node.([]any) + if !ok { + return + } + if len(arr) > 10 { + if candidate, ok := arr[10].([]any); ok && len(candidate) > 0 { + if _, ok := candidate[0].(string); ok { + if data, err := json.Marshal(candidate); err == nil { + *calls = append(*calls, data) + } + } + } + } + for _, child := range arr { + scanInteractionCalls(child, calls, depth+1) + } +} + // decodeInteractionDelta 解码 content delta:field 1 文本、field 2 图片、field 3 音频、field 4 文档、field 5 视频、field 6 思考摘要、field 7 思考签名、field 10 引用 func decodeInteractionDelta(method string, raw json.RawMessage, emit func(Event) error) error { delta, err := rawArray(raw, "$delta", raw) From 4bfcff3baac4f2cabbcaf1802b4a1e58374922ca Mon Sep 17 00:00:00 2001 From: likeravine233 Date: Tue, 24 Nov 2026 16:17:51 +0800 Subject: [PATCH 3/4] fix: encode declared tools for kind-2 interaction models encodeModelInteractionTarget dropped request tools entirely so upstream never saw function declarations. Encode them at interaction field 7 with the shared tool encoder, only when the request declares tools. --- internal/aistudio/interaction.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/internal/aistudio/interaction.go b/internal/aistudio/interaction.go index dbd23d8e..40c2df55 100644 --- a/internal/aistudio/interaction.go +++ b/internal/aistudio/interaction.go @@ -874,9 +874,9 @@ func trimWireNil(values []any) []any { // EncodeCreateInteractionRequest 编码官网后台 interaction 的 CreateInteraction 请求并返回参与 WAA 绑定的文本内容;目标是 agent 或 kind=2 模型 func EncodeCreateInteractionRequest(request GenerateRequest, model Model, defaults GenerationDefaults) ([]byte, int, []Content, error) { - // field 79 kind=2 的模型不是 agent:field 18 携带模型目标与 generation config,与官网一致 + // field 79 kind=2 的模型不是 agent:field 17 携带模型目标与 generation config,与官网一致 if model.Capabilities["interaction_model"] { - return encodeModelInteractionTarget(request, defaults) + return encodeModelInteractionTarget(request, model, defaults) } agent := strings.TrimPrefix(strings.TrimSpace(request.Model), "models/") // kind 是该 agent 的 agent_config 类型:带默认模型的 agent 为 antigravity,其余为 deep-research @@ -934,12 +934,20 @@ func EncodeCreateInteractionRequest(request GenerateRequest, model Model, defaul return body, proofAt, binding, nil } -// encodeModelInteractionTarget 编码 kind=2 模型的 CreateInteraction 请求:field 18 为模型目标与 generation config,generation config 与 CreateInteractionStream 同构 -func encodeModelInteractionTarget(request GenerateRequest, defaults GenerationDefaults) ([]byte, int, []Content, error) { +// encodeModelInteractionTarget 编码 kind=2 模型的 CreateInteraction 请求:field 17 为模型目标与 generation config,generation config 与 CreateInteractionStream 同构 +func encodeModelInteractionTarget(request GenerateRequest, model Model, defaults GenerationDefaults) ([]byte, int, []Content, error) { steps, binding, _, err := encodeInteractionSteps(request.Contents) if err != nil { return nil, 0, nil, err } + // field 7 只在请求显式声明工具时写入:kind=2 模型不注入目录默认工具,与官网一致 + var tools []any + if request.Tools.Explicit { + tools, err = agentTools(request.Tools, model) + if err != nil { + return nil, 0, nil, err + } + } level, err := interactionThinkingLevel(request.Config, defaults) if err != nil { return nil, 0, nil, err @@ -964,11 +972,14 @@ func encodeModelInteractionTarget(request GenerateRequest, defaults GenerationDe if system := strings.TrimSpace(SystemText(request.System)); system != "" { interaction[6] = system } + if len(tools) > 0 { + interaction[7] = tools + } // field 17 为续接的上一轮 interaction ID if request.PreviousInteractionID != "" { interaction[16] = request.PreviousInteractionID } - // field 18 为模型目标:field 1 为模型名、field 2 为 generation config + // field 17 为模型目标:field 1 为模型名、field 2 为 generation config interaction[17] = []any{wireModelName(request.Model), config} interaction[26] = []any{steps} body, proofAt, _ := marshalWAAArray([]any{nil, int64(1), int64(1), interaction, nil, int64(1)}, 5) From e51e6e2bc1cd89e155f52a6ef8883e84f4877839 Mon Sep 17 00:00:00 2001 From: likeravine233 Date: Tue, 24 Nov 2026 16:55:17 +0800 Subject: [PATCH 4/4] feat: DISABLE_INTERACTION_MODELS routes kind-2 models via GenerateContent Catalog field-79 flags mark kind=2 models for the interaction path, but the flag is a frontend hint: GenerateContent is still accepted for these models (verified on a flagged account), and the interaction task path meters against a much smaller quota pool. The new config option lets users on flagged accounts keep tool calls and normal quota via the default path. Gate lives in interactionRoute so catalog parsing stays faithful; kind=1 agent tasks are unaffected. --- README.md | 1 + docs/development.md | 1 + internal/aistudio/service.go | 6 ++++++ internal/api/admin.go | 1 + internal/app/admin.go | 2 ++ internal/app/lifecycle.go | 1 + internal/app/runtime.go | 1 + internal/config/config.go | 4 ++++ 8 files changed, 17 insertions(+) diff --git a/README.md b/README.md index a7ce015b..a4133740 100644 --- a/README.md +++ b/README.md @@ -692,6 +692,7 @@ cp .env.example .env | `STRIP_THOUGHT_SIGNATURES` | `false` | 发往上游前去掉对话历史中的思考签名 | | `SEARCH_MODEL_ALIASES` | `true` | 提供支持搜索的模型的 `-search` 型号,使用该型号时启用 Google 搜索 | | `DISCOVER_HIDDEN_MODELS` | `false` | 同步账户模型目录时找出 AI Studio 官网尚未公开的模型并加入目录 | +| `DISABLE_INTERACTION_MODELS` | `false` | kind=2 interaction 模型不按目录标记走 CreateInteractionStream/CreateInteraction,改与普通模型一样走 GenerateContent(目录标记为前端建议,实测服务端仍接受) | | `GOOGLE_SEARCH` | `false` | 为 OpenAI、Anthropic、Gemini 与 Interactions 的生成请求启用 Google 搜索,包含普通型号与携带函数工具的请求 | | `CONTINUATION_REWRITE` | `true` | 以 assistant 消息结尾的请求在不支持原生续写的模型上改写为续写请求;关闭时所有模型原样发送,上游拒绝时返回其错误 | | `CONTINUATION_PROMPT` | 内置英文续写句 | 改写时与末尾 assistant 消息一起写入系统指令的提示词;设为空时末尾 assistant 消息改作 user 消息发送 | diff --git a/docs/development.md b/docs/development.md index ce2c3e5f..cfe8d306 100644 --- a/docs/development.md +++ b/docs/development.md @@ -374,6 +374,7 @@ Camoufox 运行中与服务的 WebDriver BiDi 连接断开时,服务最多等 | `STRIP_THOUGHT_SIGNATURES` | 去掉历史中的思考签名 | `false` | | `SEARCH_MODEL_ALIASES` | 提供 `-search` 型号 | `true` | | `DISCOVER_HIDDEN_MODELS` | 探测官网隐藏模型 | `false` | +| `DISABLE_INTERACTION_MODELS` | kind=2 interaction 模型改走 GenerateContent | `false` | | `GOOGLE_SEARCH` | 全模型启用 Google 搜索 | `false` | | `CONTINUATION_REWRITE` | 末尾 assistant 轮改写为续写 | `true` | | `CONTINUATION_PROMPT` | 续写提示词 | 内置英文续写句 | diff --git a/internal/aistudio/service.go b/internal/aistudio/service.go index 62395f00..39e98ef9 100644 --- a/internal/aistudio/service.go +++ b/internal/aistudio/service.go @@ -645,11 +645,17 @@ func (l *AccountLease) InteractionRoute(modelID string) (stream bool, task bool) return interactionRoute(model, GenerationDefaults{}, l.Channel()) } +// DisableInteractionModels 置位时 kind=2 interaction 模型不按目录标记走 CreateInteractionStream/CreateInteraction,改与普通模型一样走 GenerateContent;由应用层按配置设置 +var DisableInteractionModels bool + // interactionRoute 返回模型在指定通道上是否走 CreateInteractionStream 或 CreateInteraction 后台任务 func interactionRoute(model Model, defaults GenerationDefaults, channel Channel) (stream bool, task bool) { if channel == ChannelBuild { return false, false } + if DisableInteractionModels && model.Capabilities["interaction_model"] { + return false, false + } return model.Capabilities["interaction_stream"] || defaults.InteractionStream, model.Capabilities["interaction_task"] || defaults.InteractionTask } diff --git a/internal/api/admin.go b/internal/api/admin.go index 12506b29..c3b9b5a6 100644 --- a/internal/api/admin.go +++ b/internal/api/admin.go @@ -352,6 +352,7 @@ type RuntimeConfig struct { StripThoughtSignatures bool `json:"strip_thought_signatures"` SearchModelAliases bool `json:"search_model_aliases"` DiscoverHiddenModels bool `json:"discover_hidden_models"` + DisableInteractionModels bool `json:"disable_interaction_models"` GoogleSearch bool `json:"google_search"` FirstEventHedge string `json:"first_event_hedge"` FirstEventHedgeModels string `json:"first_event_hedge_models"` diff --git a/internal/app/admin.go b/internal/app/admin.go index 60805b49..358eb386 100644 --- a/internal/app/admin.go +++ b/internal/app/admin.go @@ -1728,6 +1728,7 @@ func (admin *runtimeAdmin) UpdateRuntimeConfig(_ context.Context, value api.Runt BuildNativeNonstream: value.BuildNativeNonstream, NonstreamKeepalive: value.NonstreamKeepalive, FakeStream: value.FakeStream, YouTubeLinks: value.YouTubeLinks, SearchModelAliases: value.SearchModelAliases, DiscoverHiddenModels: value.DiscoverHiddenModels, GoogleSearch: value.GoogleSearch, StripThoughtSignatures: value.StripThoughtSignatures, + DisableInteractionModels: value.DisableInteractionModels, ContinuationRewrite: value.ContinuationRewrite, ContinuationPrompt: strings.TrimSpace(value.ContinuationPrompt), ReplyTool: value.ReplyTool, UserMessageRewrite: strings.ToLower(strings.TrimSpace(value.UserMessageRewrite)), ThinkingGuard: value.ThinkingGuard, FirstEventHedge: strings.ToLower(strings.TrimSpace(value.FirstEventHedge)), FirstEventHedgeModels: strings.TrimSpace(value.FirstEventHedgeModels), FirstEventTimeout: strings.ToLower(strings.TrimSpace(value.FirstEventTimeout)), AuthStates: value.AuthStates, ListenAddr: value.ListenAddr, PreviewListenAddr: value.PreviewListenAddr, @@ -2082,6 +2083,7 @@ func runtimeConfigDTO(cfg config.Config) api.RuntimeConfig { BuildNativeNonstream: cfg.BuildNativeNonstream, NonstreamKeepalive: cfg.NonstreamKeepalive, FakeStream: cfg.FakeStream, YouTubeLinks: cfg.YouTubeLinks, SearchModelAliases: cfg.SearchModelAliases, DiscoverHiddenModels: cfg.DiscoverHiddenModels, GoogleSearch: cfg.GoogleSearch, StripThoughtSignatures: cfg.StripThoughtSignatures, + DisableInteractionModels: cfg.DisableInteractionModels, ContinuationRewrite: cfg.ContinuationRewrite, ContinuationPrompt: cfg.ContinuationPrompt, ReplyTool: cfg.ReplyTool, UserMessageRewrite: cfg.UserMessageRewrite, ThinkingGuard: cfg.ThinkingGuard, FirstEventHedge: cfg.FirstEventHedge, FirstEventHedgeModels: cfg.FirstEventHedgeModels, FirstEventTimeout: cfg.FirstEventTimeout, AuthStates: cfg.AuthStates, ListenAddr: cfg.ListenAddr, APIKey: cfg.ProxyAPIKey, diff --git a/internal/app/lifecycle.go b/internal/app/lifecycle.go index 887ccdfd..2d3ac34f 100644 --- a/internal/app/lifecycle.go +++ b/internal/app/lifecycle.go @@ -778,6 +778,7 @@ func (manager *runtimeManager) UpdateRuntimeConfig(ctx context.Context, value ap ) mapping, _ := config.ParseModelMapping(updated.ModelMapping) current.service.SetRequestPolicy(mapping, updated.MaxAccountSwitches) + aistudio.DisableInteractionModels = updated.DisableInteractionModels manager.settings.Store(&requestSettings{ modes: api.ResponseModes{NonstreamKeepalive: updated.NonstreamKeepalive, FakeStream: updated.FakeStream}, searchModelAliases: updated.SearchModelAliases, diff --git a/internal/app/runtime.go b/internal/app/runtime.go index 1469f01c..0f3ef52b 100644 --- a/internal/app/runtime.go +++ b/internal/app/runtime.go @@ -106,6 +106,7 @@ func newRuntime( pooled.YouTubeLinks = cfg.YouTubeLinks pooled.DiscoverHiddenModels = cfg.DiscoverHiddenModels pooled.StripThoughtSignatures = cfg.StripThoughtSignatures + aistudio.DisableInteractionModels = cfg.DisableInteractionModels pooled.ContinuationRewrite = cfg.ContinuationRewrite pooled.ContinuationPrompt = cfg.ContinuationPrompt service := newTrackedService(lifecycle, pooled, pool, requests, workers, cfg.RequestTimeout) diff --git a/internal/config/config.go b/internal/config/config.go index 38627486..7c922690 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -66,6 +66,7 @@ var configKeys = [...]string{ "STRIP_THOUGHT_SIGNATURES", "SEARCH_MODEL_ALIASES", "DISCOVER_HIDDEN_MODELS", + "DISABLE_INTERACTION_MODELS", "GOOGLE_SEARCH", "FIRST_EVENT_HEDGE", "FIRST_EVENT_HEDGE_MODELS", @@ -142,6 +143,7 @@ type Config struct { StripThoughtSignatures bool SearchModelAliases bool DiscoverHiddenModels bool + DisableInteractionModels bool GoogleSearch bool FirstEventHedge string FirstEventHedgeModels string @@ -256,6 +258,7 @@ var configSetters = map[string]func(*Config, string) error{ "GOOGLE_SEARCH": boolSetter("GOOGLE_SEARCH", func(c *Config) *bool { return &c.GoogleSearch }), "YOUTUBE_LINKS": boolSetter("YOUTUBE_LINKS", func(c *Config) *bool { return &c.YouTubeLinks }), "STRIP_THOUGHT_SIGNATURES": boolSetter("STRIP_THOUGHT_SIGNATURES", func(c *Config) *bool { return &c.StripThoughtSignatures }), + "DISABLE_INTERACTION_MODELS": boolSetter("DISABLE_INTERACTION_MODELS", func(c *Config) *bool { return &c.DisableInteractionModels }), "CONTINUATION_REWRITE": boolSetter("CONTINUATION_REWRITE", func(c *Config) *bool { return &c.ContinuationRewrite }), "REPLY_TOOL": boolSetter("REPLY_TOOL", func(c *Config) *bool { return &c.ReplyTool }), "USER_MESSAGE_REWRITE": textSetter(func(c *Config) *string { return &c.UserMessageRewrite }, lowerTrim), @@ -644,6 +647,7 @@ func (c Config) envValues() map[string]string { "YOUTUBE_LINKS": strconv.FormatBool(c.YouTubeLinks), "STRIP_THOUGHT_SIGNATURES": strconv.FormatBool(c.StripThoughtSignatures), "SEARCH_MODEL_ALIASES": strconv.FormatBool(c.SearchModelAliases), + "DISABLE_INTERACTION_MODELS": strconv.FormatBool(c.DisableInteractionModels), "DISCOVER_HIDDEN_MODELS": strconv.FormatBool(c.DiscoverHiddenModels), "GOOGLE_SEARCH": strconv.FormatBool(c.GoogleSearch), "FIRST_EVENT_HEDGE": c.FirstEventHedge,