Skip to content

Commit 554e954

Browse files
committed
chore: expose recreate credentials route to admins
Signed-off-by: Grant Linville <[email protected]>
1 parent 083b6b7 commit 554e954

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module github.com/obot-platform/obot
33
go 1.24.0
44

55
replace (
6+
github.com/gptscript-ai/go-gptscript => /Users/grant/devel/go-gptscript
7+
github.com/gptscript-ai/gptscript => /Users/grant/devel/gptscript
68
github.com/obot-platform/obot/apiclient => ./apiclient
79
github.com/obot-platform/obot/logger => ./logger
810
)
@@ -16,7 +18,7 @@ require (
1618
github.com/golang-jwt/jwt/v5 v5.2.1
1719
github.com/google/uuid v1.6.0
1820
github.com/gorilla/websocket v1.5.0
19-
github.com/gptscript-ai/chat-completion-client v0.0.0-20250128181713-57857b74f9f1
21+
github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d
2022
github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432
2123
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250222170845-eee4337500a6
2224
github.com/gptscript-ai/gptscript v0.9.6-0.20250222165900-86e85f032cc9

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,10 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm
295295
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
296296
github.com/gptscript-ai/broadcaster v0.0.0-20240625175512-c43682019b86 h1:m9yLtIEd0z1ia8qFjq3u0Ozb6QKwidyL856JLJp6nbA=
297297
github.com/gptscript-ai/broadcaster v0.0.0-20240625175512-c43682019b86/go.mod h1:lK3K5EZx4dyT24UG3yCt0wmspkYqrj4D/8kxdN3relk=
298-
github.com/gptscript-ai/chat-completion-client v0.0.0-20250128181713-57857b74f9f1 h1:D8VmhL68Fm6YI7fue4wkzd1TqODn//LtcJtPvWk8BQ8=
299-
github.com/gptscript-ai/chat-completion-client v0.0.0-20250128181713-57857b74f9f1/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
298+
github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d h1:p5uqZufDIMQzAALblZFkr8fwbnZbFXbBCR1ZMAFylXk=
299+
github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
300300
github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432 h1:cJh/Hl1HFd1qLpdkaZvsFTC2mXlIuiK7FgvSfaSOWmw=
301301
github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432/go.mod h1:DJAo1xTht1LDkNYFNydVjTHd576TC7MlpsVRl3oloVw=
302-
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250222170845-eee4337500a6 h1:vsZ09cWfNWUXT6AOVQc1GpfEdIxcLusUs6Hgo9IgAKs=
303-
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250222170845-eee4337500a6/go.mod h1:QvGPZoRuAiA8P5EzPI05kTrs+LZ0ipHywUGsKruSknw=
304-
github.com/gptscript-ai/gptscript v0.9.6-0.20250222165900-86e85f032cc9 h1:TIHbI5k7kwv/ijm8qzjoBRh6DRq1FtjP+OLYu9dfDA8=
305-
github.com/gptscript-ai/gptscript v0.9.6-0.20250222165900-86e85f032cc9/go.mod h1:uvb92bYHRX9wFHSS1jkg5Y7GBQgTb8iHP+l/wPsWCx8=
306302
github.com/gptscript-ai/tui v0.0.0-20250204145344-33cd15de4cee h1:70PHW6Xw70yNNZ5aX936XqcMLwNmfMZpCV3FCOGKpxE=
307303
github.com/gptscript-ai/tui v0.0.0-20250204145344-33cd15de4cee/go.mod h1:iwHxuueg2paOak7zIg0ESBWx7A0wIHGopAratbgaPNY=
308304
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=

pkg/api/handlers/credentials.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,12 @@ func convertCredential(cred gptscript.Credential) types.Credential {
5151
ExpiresAt: types.NewTimeFromPointer(cred.ExpiresAt),
5252
}
5353
}
54+
55+
func RecreateAllCredentials(req api.Context) error {
56+
err := req.GPTClient.RecreateAllCredentials(req.Context())
57+
if err != nil {
58+
return err
59+
}
60+
61+
return nil
62+
}

pkg/api/router/router.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ func Router(services *services.Services) (http.Handler, error) {
282282
mux.HandleFunc("DELETE /api/agents/{context}/credentials/{id}", handlers.DeleteCredential)
283283
mux.HandleFunc("GET /api/credentials", handlers.ListCredentials)
284284
mux.HandleFunc("DELETE /api/credentials/{id}", handlers.DeleteCredential)
285+
mux.HandleFunc("POST /api/credentials/recreate-all", handlers.RecreateAllCredentials)
285286
mux.HandleFunc("GET /api/threads/{context}/credentials", handlers.ListCredentials)
286287
mux.HandleFunc("DELETE /api/threads/{context}/credentials/{id}", handlers.DeleteCredential)
287288

0 commit comments

Comments
 (0)