Support configuring effort alongside model
This commit is contained in:
@@ -32,6 +32,7 @@ type Options struct {
|
||||
Dir string
|
||||
Cwd string
|
||||
Model string
|
||||
Effort string
|
||||
Resume string
|
||||
Env []string
|
||||
Guidance string
|
||||
@@ -120,6 +121,7 @@ type Session struct {
|
||||
mu sync.Mutex
|
||||
p *proc
|
||||
model string
|
||||
effort string
|
||||
killed bool
|
||||
images int
|
||||
|
||||
@@ -152,6 +154,7 @@ func Start(ctx context.Context, opts Options) (*Session, error) {
|
||||
s := &Session{
|
||||
opts: opts,
|
||||
model: opts.Model,
|
||||
effort: opts.Effort,
|
||||
convID: opts.Resume,
|
||||
events: make(chan Event, 256),
|
||||
dead: make(chan struct{}),
|
||||
@@ -296,6 +299,9 @@ func (s *Session) spawnLocked() error {
|
||||
if s.model != "" {
|
||||
args = append(args, "--model", s.model)
|
||||
}
|
||||
if s.effort != "" {
|
||||
args = append(args, "--effort", s.effort)
|
||||
}
|
||||
if id := s.ID(); id != "" {
|
||||
args = append(args, "--conversation", id)
|
||||
}
|
||||
@@ -514,14 +520,15 @@ func (s *Session) Interrupt() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Session) SetModel(model string) error {
|
||||
func (s *Session) SetModel(model, effort string) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if model == s.model {
|
||||
if model == s.model && effort == s.effort {
|
||||
return nil
|
||||
}
|
||||
s.model = model
|
||||
s.effort = effort
|
||||
s.p.expected = true
|
||||
s.p.stdin.Close()
|
||||
err := s.restartLocked()
|
||||
|
||||
Reference in New Issue
Block a user