From 963034f3310204f4fec6f1cd21ed74a4b3c66187 Mon Sep 17 00:00:00 2001 From: Daishan Peng Date: Wed, 26 Mar 2025 16:25:26 -0700 Subject: [PATCH] Enhance: Add ability to do inline prompt to choose oauth/pat Signed-off-by: Daishan Peng --- apiclient/types/invoke.go | 8 ++++--- apiclient/types/zz_generated.deepcopy.go | 5 +++++ go.mod | 4 ++-- go.sum | 8 +++---- .../openapi/generated/openapi_generated.go | 14 ++++++++++++ .../lib/components/messages/Message.svelte | 22 ++++++++++++++----- .../lib/components/navbar/Credentials.svelte | 5 ++++- ui/user/src/lib/services/chat/types.ts | 1 + 8 files changed, 51 insertions(+), 16 deletions(-) diff --git a/apiclient/types/invoke.go b/apiclient/types/invoke.go index 282ecd574e..a51438c04c 100644 --- a/apiclient/types/invoke.go +++ b/apiclient/types/invoke.go @@ -89,9 +89,10 @@ type Prompt struct { // Field should match exactly what is in the GPTScript SDK type Field struct { - Name string `json:"name,omitempty"` - Sensitive *bool `json:"sensitive,omitempty"` - Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + Sensitive *bool `json:"sensitive,omitempty"` + Description string `json:"description,omitempty"` + Options []string `json:"options,omitempty"` } type Fields []Field @@ -103,6 +104,7 @@ func ToFields(fields gptscript.Fields) Fields { Name: field.Name, Sensitive: field.Sensitive, Description: field.Description, + Options: field.Options, } } return f diff --git a/apiclient/types/zz_generated.deepcopy.go b/apiclient/types/zz_generated.deepcopy.go index b70d9a074b..f4cf13385d 100644 --- a/apiclient/types/zz_generated.deepcopy.go +++ b/apiclient/types/zz_generated.deepcopy.go @@ -717,6 +717,11 @@ func (in *Field) DeepCopyInto(out *Field) { *out = new(bool) **out = **in } + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Field. diff --git a/go.mod b/go.mod index cf51e75013..2a74a9ac10 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/google/uuid v1.6.0 github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432 - github.com/gptscript-ai/go-gptscript v0.9.6-0.20250314150104-8d1f06fa87a4 - github.com/gptscript-ai/gptscript v0.9.6-0.20250328171703-550d649b5fe1 + github.com/gptscript-ai/go-gptscript v0.9.6-0.20250331192455-415de950d72d + github.com/gptscript-ai/gptscript v0.9.6-0.20250328194144-ce3b7262ed0e github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de github.com/mhale/smtpd v0.8.3 github.com/obot-platform/kinm v0.0.0-20250307141751-3a6f13867f67 diff --git a/go.sum b/go.sum index bf079447a2..70b6c4dc8b 100644 --- a/go.sum +++ b/go.sum @@ -297,10 +297,10 @@ github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1 github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo= github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432 h1:cJh/Hl1HFd1qLpdkaZvsFTC2mXlIuiK7FgvSfaSOWmw= github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432/go.mod h1:DJAo1xTht1LDkNYFNydVjTHd576TC7MlpsVRl3oloVw= -github.com/gptscript-ai/go-gptscript v0.9.6-0.20250314150104-8d1f06fa87a4 h1:V30gwE9c6yEYQmWoKCvrfpGmsTTlEicHr5nGJZV4Uyk= -github.com/gptscript-ai/go-gptscript v0.9.6-0.20250314150104-8d1f06fa87a4/go.mod h1:QvGPZoRuAiA8P5EzPI05kTrs+LZ0ipHywUGsKruSknw= -github.com/gptscript-ai/gptscript v0.9.6-0.20250328171703-550d649b5fe1 h1:AMtjmE+yY01McVzEGbQ3TZ6fFxuZh63zgs0xNUGWKDc= -github.com/gptscript-ai/gptscript v0.9.6-0.20250328171703-550d649b5fe1/go.mod h1:wQ9GU40Po6fSBEciAQI2kxeo32qK4DybbpD6bIOBPtM= +github.com/gptscript-ai/go-gptscript v0.9.6-0.20250331192455-415de950d72d h1:S9gfdnk0VK3dSFOHn/rhPWBbbOoC64uy38rRKIPLLcQ= +github.com/gptscript-ai/go-gptscript v0.9.6-0.20250331192455-415de950d72d/go.mod h1:QvGPZoRuAiA8P5EzPI05kTrs+LZ0ipHywUGsKruSknw= +github.com/gptscript-ai/gptscript v0.9.6-0.20250328194144-ce3b7262ed0e h1:v0j1Vb1g6zVN4YbcV8kBc/nJRXiy5kWOTBnEW+vAbvs= +github.com/gptscript-ai/gptscript v0.9.6-0.20250328194144-ce3b7262ed0e/go.mod h1:wQ9GU40Po6fSBEciAQI2kxeo32qK4DybbpD6bIOBPtM= github.com/gptscript-ai/tui v0.0.0-20250204145344-33cd15de4cee h1:70PHW6Xw70yNNZ5aX936XqcMLwNmfMZpCV3FCOGKpxE= github.com/gptscript-ai/tui v0.0.0-20250204145344-33cd15de4cee/go.mod h1:iwHxuueg2paOak7zIg0ESBWx7A0wIHGopAratbgaPNY= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= diff --git a/pkg/storage/openapi/generated/openapi_generated.go b/pkg/storage/openapi/generated/openapi_generated.go index 50188d5cf3..21eccb145b 100644 --- a/pkg/storage/openapi/generated/openapi_generated.go +++ b/pkg/storage/openapi/generated/openapi_generated.go @@ -1660,6 +1660,20 @@ func schema_obot_platform_obot_apiclient_types_Field(ref common.ReferenceCallbac Format: "", }, }, + "options": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, }, }, }, diff --git a/ui/user/src/lib/components/messages/Message.svelte b/ui/user/src/lib/components/messages/Message.svelte index 217f244a84..add5a0cc8b 100644 --- a/ui/user/src/lib/components/messages/Message.svelte +++ b/ui/user/src/lib/components/messages/Message.svelte @@ -432,12 +432,22 @@ {#each msg.fields as field}
- + {#if field.options} +
+ {#each field.options as option} + + {/each} +
+ {:else} + + {/if} {#if field.description}

{field.description}

{/if} diff --git a/ui/user/src/lib/components/navbar/Credentials.svelte b/ui/user/src/lib/components/navbar/Credentials.svelte index fe1abbacd1..bb3f82af42 100644 --- a/ui/user/src/lib/components/navbar/Credentials.svelte +++ b/ui/user/src/lib/components/navbar/Credentials.svelte @@ -17,7 +17,10 @@ } - +