Add per-chat thinking levels for Codex, Claude Code and OpenCode
Codex: model/list supportedReasoningEfforts per model, turn/start effort, thread reasoningEffort as the current level. Claude Code: initialize supportedEffortLevels, apply_flag_settings effortLevel at the next turn start. OpenCode v2: model variants via the session model endpoint. chat_effort sets a level; rows and chat_models carry the levels; Codex and Claude levels persist in operator_sessions.chat_effort and are re-applied before every turn.
This commit is contained in:
@@ -69,6 +69,11 @@ type Chat struct {
|
||||
usage map[string]usageSnapshot
|
||||
usageOrder uint64
|
||||
modes map[string]string
|
||||
// Thinking levels (efforts.go): the cached model catalog and each
|
||||
// thread's level for its next turn/start.
|
||||
models []catalogModel
|
||||
modelsAt time.Time
|
||||
efforts map[string]string
|
||||
|
||||
// Account quota (quota.go): merged native snapshot and the read schedule.
|
||||
quota *quotaState
|
||||
@@ -447,6 +452,7 @@ func (c *Chat) PromptWithMessageIDModelFiles(ctx context.Context, id, text, mess
|
||||
params["model"] = model
|
||||
}
|
||||
c.applyMode(id, params)
|
||||
c.applyEffort(id, params)
|
||||
c.mu.Lock()
|
||||
if c.starting == nil {
|
||||
c.starting = map[string]bool{}
|
||||
@@ -980,6 +986,8 @@ type thread struct {
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
UpdatedAt int64 `json:"updatedAt"`
|
||||
Turns []turn `json:"turns"`
|
||||
// ReasoningEffort is the thread's own current thinking level.
|
||||
ReasoningEffort string `json:"reasoningEffort"`
|
||||
}
|
||||
|
||||
type turn struct {
|
||||
@@ -1037,6 +1045,7 @@ func (t thread) chatSession() protocol.ChatSession {
|
||||
return protocol.ChatSession{
|
||||
ID: t.ID, Title: title, Directory: t.Cwd,
|
||||
Model: t.Model, ModelProvider: t.ModelProvider,
|
||||
Effort: t.ReasoningEffort,
|
||||
CreatedAt: t.CreatedAt * 1000, UpdatedAt: t.UpdatedAt * 1000,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user