mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(chat): respect override model selection (#354)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user