Skip to content

Commit 30ae6c0

Browse files
committed
Enhance: Add ability to do inline prompt to choose oauth/pat
Signed-off-by: Daishan Peng <[email protected]>
1 parent 1396881 commit 30ae6c0

File tree

6 files changed

+32
-16
lines changed

6 files changed

+32
-16
lines changed

apiclient/types/invoke.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ type Prompt struct {
8989

9090
// Field should match exactly what is in the GPTScript SDK
9191
type Field struct {
92-
Name string `json:"name,omitempty"`
93-
Sensitive *bool `json:"sensitive,omitempty"`
94-
Description string `json:"description,omitempty"`
92+
Name string `json:"name,omitempty"`
93+
Sensitive *bool `json:"sensitive,omitempty"`
94+
Description string `json:"description,omitempty"`
95+
Options []string `json:"options,omitempty"`
9596
}
9697

9798
type Fields []Field
@@ -103,6 +104,7 @@ func ToFields(fields gptscript.Fields) Fields {
103104
Name: field.Name,
104105
Sensitive: field.Sensitive,
105106
Description: field.Description,
107+
Options: field.Options,
106108
}
107109
}
108110
return f

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ require (
1717
github.com/google/uuid v1.6.0
1818
github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d
1919
github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432
20-
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250314150104-8d1f06fa87a4
21-
github.com/gptscript-ai/gptscript v0.9.6-0.20250322192245-31ce029b1eb6
20+
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250331192455-415de950d72d
21+
github.com/gptscript-ai/gptscript v0.9.6-0.20250328194144-ce3b7262ed0e
2222
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
2323
github.com/mhale/smtpd v0.8.3
2424
github.com/obot-platform/kinm v0.0.0-20250307141751-3a6f13867f67

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1
297297
github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
298298
github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432 h1:cJh/Hl1HFd1qLpdkaZvsFTC2mXlIuiK7FgvSfaSOWmw=
299299
github.com/gptscript-ai/cmd v0.0.0-20250122115124-a3d65e9d2432/go.mod h1:DJAo1xTht1LDkNYFNydVjTHd576TC7MlpsVRl3oloVw=
300-
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250314150104-8d1f06fa87a4 h1:V30gwE9c6yEYQmWoKCvrfpGmsTTlEicHr5nGJZV4Uyk=
301-
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250314150104-8d1f06fa87a4/go.mod h1:QvGPZoRuAiA8P5EzPI05kTrs+LZ0ipHywUGsKruSknw=
302-
github.com/gptscript-ai/gptscript v0.9.6-0.20250322192245-31ce029b1eb6 h1:Y2LRTmdOgN30tfGOJ5HD/xdeXJGx2Q39w9TCQdXT5iU=
303-
github.com/gptscript-ai/gptscript v0.9.6-0.20250322192245-31ce029b1eb6/go.mod h1:wQ9GU40Po6fSBEciAQI2kxeo32qK4DybbpD6bIOBPtM=
300+
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250331192455-415de950d72d h1:S9gfdnk0VK3dSFOHn/rhPWBbbOoC64uy38rRKIPLLcQ=
301+
github.com/gptscript-ai/go-gptscript v0.9.6-0.20250331192455-415de950d72d/go.mod h1:QvGPZoRuAiA8P5EzPI05kTrs+LZ0ipHywUGsKruSknw=
302+
github.com/gptscript-ai/gptscript v0.9.6-0.20250328194144-ce3b7262ed0e h1:v0j1Vb1g6zVN4YbcV8kBc/nJRXiy5kWOTBnEW+vAbvs=
303+
github.com/gptscript-ai/gptscript v0.9.6-0.20250328194144-ce3b7262ed0e/go.mod h1:wQ9GU40Po6fSBEciAQI2kxeo32qK4DybbpD6bIOBPtM=
304304
github.com/gptscript-ai/tui v0.0.0-20250204145344-33cd15de4cee h1:70PHW6Xw70yNNZ5aX936XqcMLwNmfMZpCV3FCOGKpxE=
305305
github.com/gptscript-ai/tui v0.0.0-20250204145344-33cd15de4cee/go.mod h1:iwHxuueg2paOak7zIg0ESBWx7A0wIHGopAratbgaPNY=
306306
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=

ui/user/src/lib/components/messages/Message.svelte

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,22 @@
423423
{#each msg.fields as field}
424424
<div class="flex flex-col gap-1">
425425
<label for={field.name} class="mt-1 text-sm font-medium">{field.name}</label>
426-
<input
427-
class="rounded-lg bg-white p-2 outline-hidden dark:bg-gray-900"
428-
type={field.sensitive ? 'password' : 'text'}
429-
name={field.name}
430-
bind:value={promptCredentials[field.name]}
431-
/>
426+
{#if field.options}
427+
<div class="flex flex-col gap-2">
428+
{#each field.options as option}
429+
<button class="button" onclick={() => (promptCredentials[field.name] = option)}>
430+
{option}
431+
</button>
432+
{/each}
433+
</div>
434+
{:else}
435+
<input
436+
class="rounded-lg bg-white p-2 outline-hidden dark:bg-gray-900"
437+
type={field.sensitive ? 'password' : 'text'}
438+
name={field.name}
439+
bind:value={promptCredentials[field.name]}
440+
/>
441+
{/if}
432442
{#if field.description}
433443
<p class="text-sm text-gray-500">{field.description}</p>
434444
{/if}

ui/user/src/lib/components/navbar/Credentials.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
}
1818
</script>
1919

20-
<dialog bind:this={dialog} class="h-1/4 min-h-[300px] w-1/3 min-w-[300px] overflow-visible p-5">
20+
<dialog
21+
bind:this={dialog}
22+
class="max-h-[90vh] min-h-[300px] w-1/3 min-w-[300px] overflow-visible p-5"
23+
>
2124
<div class="flex h-full flex-col">
2225
<button class="absolute top-0 right-0 p-3" onclick={() => dialog?.close()}>
2326
<X class="icon-default" />

ui/user/src/lib/services/chat/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type PromptField = {
4545
name: string;
4646
description?: string;
4747
sensitive?: boolean;
48+
options?: string[];
4849
};
4950

5051
type ToolInput = {

0 commit comments

Comments
 (0)