You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/builder/src/pages/builder/workspace/[application]/agent/[agentId]/GenerateInstructionsControl.svelte
+24-11Lines changed: 24 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -69,14 +69,16 @@
69
69
)
70
70
let modal =$state<Modal>()
71
71
let promptField =$state<TextArea>()
72
-
let prompt =$state("")
72
+
let promptInputKey =$state(0)
73
+
let canGenerate =$state(false)
73
74
let generatedInstructions =$state("")
74
75
let generating =$state(false)
75
76
let requestToken =$state(0)
76
77
77
78
function resetState() {
78
79
requestToken+=1
79
-
prompt=""
80
+
promptInputKey+=1
81
+
canGenerate=false
80
82
generatedInstructions=""
81
83
generating=false
82
84
}
@@ -96,6 +98,12 @@
96
98
return
97
99
}
98
100
101
+
const prompt =promptField?.contents() ||""
102
+
if (!prompt.trim()) {
103
+
canGenerate=false
104
+
return
105
+
}
106
+
99
107
const currentRequestToken =++requestToken
100
108
generating=true
101
109
@@ -175,22 +183,27 @@
175
183
>
176
184
</div>
177
185
{:else}
178
-
<TextArea
179
-
label="Prompt"
180
-
bind:this={promptField}
181
-
bind:value={prompt}
182
-
minHeight={140}
183
-
disabled={generating}
184
-
placeholder="Describe what kind of instructions you want to generate..."
185
-
/>
186
+
{#keypromptInputKey}
187
+
<TextArea
188
+
label="Prompt"
189
+
bind:this={promptField}
190
+
updateOnChange
191
+
minHeight={140}
192
+
disabled={generating}
193
+
placeholder="Describe what kind of instructions you want to generate..."
0 commit comments