Skip to content

Commit

Permalink
chore: add simple logging for cred stores
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Nov 5, 2024
1 parent 9aeb1cd commit 2a9f664
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions pkg/gptscript/gptscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ type simpleRunner struct {
func newSimpleRunner(cache *cache.Client, rm engine.RuntimeManager, env []string) (*simpleRunner, error) {
runner, err := runner.New(noopModel{}, credentials.NoopStore{}, runner.Options{
RuntimeManager: rm,
MonitorFactory: simpleMonitorFactory{},
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -319,3 +320,33 @@ func (n noopModel) Call(_ context.Context, _ types.CompletionRequest, _ []string
func (n noopModel) ProxyInfo() (string, string, error) {
return "", "", errors.New("unsupported")
}

type simpleMonitorFactory struct {
}

func (s simpleMonitorFactory) Start(_ context.Context, _ *types.Program, _ []string, _ string) (runner.Monitor, error) {
return simpleMonitor{}, nil
}

func (s simpleMonitorFactory) Pause() func() {
//TODO implement me
panic("implement me")
}

type simpleMonitor struct {
}

func (s simpleMonitor) Stop(_ context.Context, _ string, _ error) {
}

func (s simpleMonitor) Event(event runner.Event) {
if event.Type == runner.EventTypeCallProgress {
if !strings.HasPrefix(event.Content, "{") {
fmt.Println(event.Content)
}
}
}

func (s simpleMonitor) Pause() func() {
return func() {}
}

0 comments on commit 2a9f664

Please sign in to comment.