fix(chat): respect override model selection (#354)

This commit is contained in:
Fodesu
2026-04-10 02:31:29 +08:00
committed by GitHub
parent f2fa845e16
commit 19619d73a9
2 changed files with 47 additions and 6 deletions
+16 -6
View File
@@ -179,6 +179,8 @@ func (r *Resolver) resolve(ctx context.Context, req conversation.ChatRequest) (r
ReplyTarget: req.ReplyTarget,
ConversationType: req.ConversationType,
SessionToken: req.ChatToken,
Model: req.Model,
Provider: req.Provider,
ReasoningEffort: req.ReasoningEffort,
})
if err != nil {
@@ -345,6 +347,8 @@ type baseRunConfigParams struct {
ConversationType string
SessionToken string //nolint:gosec // session credential material, not a hardcoded secret
SessionType string
Model string
Provider string
ReasoningEffort string // caller-provided override (empty = use bot default)
}
@@ -364,12 +368,7 @@ func (r *Resolver) buildBaseRunConfig(ctx context.Context, p baseRunConfigParams
chatID = p.BotID
}
req := conversation.ChatRequest{
BotID: p.BotID,
ChatID: chatID,
SessionID: p.SessionID,
CurrentChannel: p.CurrentPlatform,
}
req := buildModelSelectionRequest(p, chatID)
chatModel, provider, err := r.selectChatModel(ctx, req, botSettings, conversation.Settings{})
if err != nil {
@@ -442,6 +441,17 @@ func (r *Resolver) buildBaseRunConfig(ctx context.Context, p baseRunConfigParams
return cfg, chatModel, provider, nil
}
func buildModelSelectionRequest(p baseRunConfigParams, chatID string) conversation.ChatRequest {
return conversation.ChatRequest{
BotID: p.BotID,
ChatID: chatID,
SessionID: p.SessionID,
CurrentChannel: p.CurrentPlatform,
Model: p.Model,
Provider: p.Provider,
}
}
// ResolveRunConfig builds a complete RunConfig (model, system prompt, tools,
// identity) for a bot+session without loading messages or requiring a query.
// The caller is responsible for filling RunConfig.Messages.