Skip to content

Commit

Permalink
fix: remove workspace get dir
Browse files Browse the repository at this point in the history
We can no longer assume that a workspace is a directory. Therefore, it
doesn't make sense to provide a method for getting the directory of a
workspace.

Signed-off-by: Donnie Adams <[email protected]>
  • Loading branch information
thedadams committed Oct 31, 2024
1 parent 213441f commit 231faa8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
7 changes: 2 additions & 5 deletions pkg/api/handlers/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/otto8-ai/otto8/pkg/api"
v1 "github.com/otto8-ai/otto8/pkg/storage/apis/otto.gptscript.ai/v1"
"github.com/otto8-ai/otto8/pkg/storage/selectors"
"github.com/otto8-ai/otto8/pkg/workspace"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
Expand Down Expand Up @@ -98,7 +97,7 @@ func uploadKnowledgeToWorkspace(req api.Context, gClient *gptscript.GPTScript, w
file := v1.KnowledgeFile{
ObjectMeta: metav1.ObjectMeta{
Name: v1.ObjectNameFromAbsolutePath(
filepath.Join(workspace.GetDir(ws.Status.WorkspaceID), filename),
filepath.Join(ws.Status.WorkspaceID, filename),
),
Namespace: ws.Namespace,
},
Expand Down Expand Up @@ -212,12 +211,10 @@ func deleteKnowledge(req api.Context, filename string, knowledgeSetName string)
}

func deleteKnowledgeFromWorkspace(req api.Context, filename string, ws *v1.Workspace) error {
fileObjectName := v1.ObjectNameFromAbsolutePath(filepath.Join(workspace.GetDir(ws.Status.WorkspaceID), filename))

if err := req.Delete(&v1.KnowledgeFile{
ObjectMeta: metav1.ObjectMeta{
Namespace: ws.Namespace,
Name: fileObjectName,
Name: v1.ObjectNameFromAbsolutePath(filepath.Join(ws.Status.WorkspaceID, filename)),
},
}); err != nil {
return err
Expand Down
13 changes: 0 additions & 13 deletions pkg/workspace/workspace.go

This file was deleted.

0 comments on commit 231faa8

Please sign in to comment.