@@ -4,26 +4,29 @@ import (
4
4
"encoding/json"
5
5
"fmt"
6
6
"net/http"
7
+ "strings"
7
8
8
9
gcontext "github.com/gptscript-ai/gptscript/pkg/context"
9
10
"github.com/gptscript-ai/gptscript/pkg/loader"
10
11
)
11
12
12
13
type workspaceCommonRequest struct {
13
- ID string `json:"id"`
14
- WorkspaceToolRepo string `json:"workspaceToolRepo "`
14
+ ID string `json:"id"`
15
+ WorkspaceTool string `json:"workspaceTool "`
15
16
}
16
17
17
18
func (w workspaceCommonRequest ) getToolRepo () string {
18
- if w .WorkspaceToolRepo != "" {
19
- return w .WorkspaceToolRepo
19
+ if w .WorkspaceTool != "" {
20
+ return w .WorkspaceTool
20
21
}
21
22
return "github.com/gptscript-ai/workspace-provider"
22
23
}
23
24
24
25
type createWorkspaceRequest struct {
25
26
workspaceCommonRequest `json:",inline"`
26
- ProviderType string `json:"providerType"`
27
+ ProviderType string `json:"providerType"`
28
+ DirectoryDataHome string `json:"directoryDataHome"`
29
+ FromWorkspaceIDs []string `json:"fromWorkspaceIDs"`
27
30
}
28
31
29
32
func (s * server ) createWorkspace (w http.ResponseWriter , r * http.Request ) {
@@ -49,8 +52,8 @@ func (s *server) createWorkspace(w http.ResponseWriter, r *http.Request) {
49
52
prg ,
50
53
s .gptscriptOpts .Env ,
51
54
fmt .Sprintf (
52
- `{"provider": "%s"}` ,
53
- reqObject .ProviderType ,
55
+ `{"provider": "%s", "data_home": "%s", "workspace_ids": "%s" }` ,
56
+ reqObject .ProviderType , reqObject . DirectoryDataHome , strings . Join ( reqObject . FromWorkspaceIDs , "," ),
54
57
),
55
58
)
56
59
if err != nil {
0 commit comments