Skip to content

Commit 4c1b403

Browse files
committed
feat: add to workspace fileinfo
1 parent 7efb340 commit 4c1b403

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

workspace.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (g *GPTScript) StatFileInWorkspace(ctx context.Context, filePath string, op
228228
out, err := g.runBasicCommand(ctx, "workspaces/stat-file", map[string]any{
229229
"id": opt.WorkspaceID,
230230
"filePath": filePath,
231-
"workspaceTool": g.globalOpts.WorkspaceTool,
231+
"workspaceTool": "/home/thklein/git/github.com/gptscript-ai/workspace-provider",
232232
"env": g.globalOpts.Env,
233233
})
234234
if err != nil {
@@ -252,4 +252,5 @@ type FileInfo struct {
252252
Name string
253253
Size int64
254254
ModTime time.Time
255+
MimeType string
255256
}

workspace_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ func TestWriteReadAndDeleteFileFromWorkspace(t *testing.T) {
7575
t.Errorf("Unexpected file mod time: %v", fileInfo.ModTime)
7676
}
7777

78+
if fileInfo.MimeType != "text/plain" {
79+
t.Errorf("Unexpected file mime type: %s", fileInfo.MimeType)
80+
}
81+
7882
// Ensure we get the error we expect when trying to read a non-existent file
7983
_, err = g.ReadFileInWorkspace(context.Background(), "test1.txt", ReadFileInWorkspaceOptions{WorkspaceID: id})
8084
if nf := (*NotFoundInWorkspaceError)(nil); !errors.As(err, &nf) {
@@ -226,6 +230,10 @@ func TestWriteReadAndDeleteFileFromWorkspaceS3(t *testing.T) {
226230
t.Errorf("Unexpected file mod time: %v", fileInfo.ModTime)
227231
}
228232

233+
if fileInfo.MimeType != "text/plain" {
234+
t.Errorf("Unexpected file mime type: %s", fileInfo.MimeType)
235+
}
236+
229237
// Ensure we get the error we expect when trying to read a non-existent file
230238
_, err = g.ReadFileInWorkspace(context.Background(), "test1.txt", ReadFileInWorkspaceOptions{WorkspaceID: id})
231239
if nf := (*NotFoundInWorkspaceError)(nil); !errors.As(err, &nf) {

0 commit comments

Comments
 (0)