Skip to content

Commit 2a9f664

Browse files
chore: add simple logging for cred stores
1 parent 9aeb1cd commit 2a9f664

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

pkg/gptscript/gptscript.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ type simpleRunner struct {
288288
func newSimpleRunner(cache *cache.Client, rm engine.RuntimeManager, env []string) (*simpleRunner, error) {
289289
runner, err := runner.New(noopModel{}, credentials.NoopStore{}, runner.Options{
290290
RuntimeManager: rm,
291+
MonitorFactory: simpleMonitorFactory{},
291292
})
292293
if err != nil {
293294
return nil, err
@@ -319,3 +320,33 @@ func (n noopModel) Call(_ context.Context, _ types.CompletionRequest, _ []string
319320
func (n noopModel) ProxyInfo() (string, string, error) {
320321
return "", "", errors.New("unsupported")
321322
}
323+
324+
type simpleMonitorFactory struct {
325+
}
326+
327+
func (s simpleMonitorFactory) Start(_ context.Context, _ *types.Program, _ []string, _ string) (runner.Monitor, error) {
328+
return simpleMonitor{}, nil
329+
}
330+
331+
func (s simpleMonitorFactory) Pause() func() {
332+
//TODO implement me
333+
panic("implement me")
334+
}
335+
336+
type simpleMonitor struct {
337+
}
338+
339+
func (s simpleMonitor) Stop(_ context.Context, _ string, _ error) {
340+
}
341+
342+
func (s simpleMonitor) Event(event runner.Event) {
343+
if event.Type == runner.EventTypeCallProgress {
344+
if !strings.HasPrefix(event.Content, "{") {
345+
fmt.Println(event.Content)
346+
}
347+
}
348+
}
349+
350+
func (s simpleMonitor) Pause() func() {
351+
return func() {}
352+
}

0 commit comments

Comments
 (0)