Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
change: back to stock NewGPTScript
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 committed Oct 29, 2024
1 parent bf3fde2 commit 7b089d1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
29 changes: 0 additions & 29 deletions pkg/client/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"strings"

"github.com/go-git/go-git/v5/plumbing/format/gitignore"
"github.com/gptscript-ai/go-gptscript"
"github.com/gptscript-ai/gptscript/pkg/sdkserver"
"github.com/gptscript-ai/knowledge/pkg/datastore"
"github.com/gptscript-ai/knowledge/pkg/datastore/documentloader"
remotes "github.com/gptscript-ai/knowledge/pkg/datastore/documentloader/remote"
Expand All @@ -23,33 +21,6 @@ import (
"golang.org/x/sync/semaphore"
)

func newGPTScript(ctx context.Context) (*gptscript.GPTScript, error) {
workspaceTool := os.Getenv("WORKSPACE_TOOL")
if workspaceTool == "" {
workspaceTool = "github.com/gptscript-ai/workspace-provider"
}
if os.Getenv("GPTSCRIPT_URL") != "" {
return gptscript.NewGPTScript(gptscript.GlobalOptions{
URL: os.Getenv("GPTSCRIPT_URL"),
WorkspaceTool: workspaceTool,
})
}

url, err := sdkserver.EmbeddedStart(ctx)
if err != nil {
return nil, err
}

if err := os.Setenv("GPTSCRIPT_URL", url); err != nil {
return nil, err
}

return gptscript.NewGPTScript(gptscript.GlobalOptions{
URL: url,
WorkspaceTool: workspaceTool,
})
}

func ingestPaths(ctx context.Context, c Client, opts *IngestPathsOpts, datasetID string, ingestionFunc func(path string, metadata map[string]any) error, paths ...string) (int, int, error) {
ingestedFilesCount := 0
skippedUnsupportedFilesCount := 0
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type StandaloneClient struct {
}

func NewStandaloneClient(ctx context.Context, ds *datastore.Datastore) (*StandaloneClient, error) {
gs, err := newGPTScript(ctx)
gs, err := gptscript.NewGPTScript()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 7b089d1

Please sign in to comment.