Skip to content

Commit

Permalink
bug: fix broken tables in user ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Dec 16, 2024
1 parent f10ae21 commit d89d04d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/api/handlers/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func NewTableHandler(gptScript *gptscript.GPTScript) *TableHandler {

func (t *TableHandler) tables(req api.Context, workspaceID string) (string, error) {
var toolRef v1.ToolReference
if err := req.Get(&toolRef, "database-tables"); err != nil {
if err := req.Get(&toolRef, "database"); err != nil {
return "", err
}
run, err := t.gptScript.Run(req.Context(), toolRef.Status.Reference, gptscript.Options{
run, err := t.gptScript.Run(req.Context(), "Tables from "+toolRef.Status.Reference, gptscript.Options{
Workspace: workspaceID,
})
if err != nil {
Expand All @@ -38,7 +38,7 @@ func (t *TableHandler) tables(req api.Context, workspaceID string) (string, erro

func (t *TableHandler) rows(req api.Context, workspaceID, tableName string) (string, error) {
var toolRef v1.ToolReference
if err := req.Get(&toolRef, "database-query"); err != nil {
if err := req.Get(&toolRef, "database"); err != nil {
return "", err
}
input, err := json.Marshal(map[string]string{
Expand All @@ -47,7 +47,7 @@ func (t *TableHandler) rows(req api.Context, workspaceID, tableName string) (str
if err != nil {
return "", err
}
run, err := t.gptScript.Run(req.Context(), toolRef.Status.Reference, gptscript.Options{
run, err := t.gptScript.Run(req.Context(), "Query from "+toolRef.Status.Reference, gptscript.Options{
Input: string(input),
Workspace: workspaceID,
})
Expand Down

0 comments on commit d89d04d

Please sign in to comment.