Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit68b90ad

Browse files
committed
override ai prompt with preset if defined
1 parent0c6ede1 commit68b90ad

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎site/src/pages/TasksPage/TasksPage.tsx‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
236236
constselectedTemplate=templates.find(
237237
(t)=>t.id===selectedTemplateId,
238238
)asTemplate;
239+
240+
// Extract AI prompt from selected preset
241+
constselectedPreset=presets?.find((p)=>p.ID===selectedPresetId);
242+
constpresetAIPrompt=selectedPreset?.Parameters.find(
243+
(param)=>param.Name==="ai_prompt",
244+
)?.Value;
245+
constisPromptReadOnly=!!presetAIPrompt;
239246
const{
240247
externalAuth,
241248
externalAuthError,
@@ -291,8 +298,7 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
291298

292299
constform=e.currentTarget;
293300
constformData=newFormData(form);
294-
constprompt=formData.get("prompt")asstring;
295-
consttemplateID=formData.get("templateID")asstring;
301+
constprompt=presetAIPrompt||(formData.get("prompt")asstring);
296302

297303
try{
298304
awaitcreateTaskMutation.mutateAsync({
@@ -326,9 +332,13 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
326332
required
327333
id="prompt"
328334
name="prompt"
335+
value={presetAIPrompt||undefined}
336+
readOnly={isPromptReadOnly}
329337
placeholder={textareaPlaceholder}
330338
className={`border-0 resize-none w-full h-full bg-transparent rounded-lg outline-none flex min-h-[60px]
331-
text-sm shadow-sm text-content-primary placeholder:text-content-secondary md:text-sm`}
339+
text-sm shadow-sm text-content-primary placeholder:text-content-secondary md:text-sm${
340+
isPromptReadOnly ?"opacity-60 cursor-not-allowed" :""
341+
}`}
332342
/>
333343
<divclassName="flex items-center justify-between pt-2">
334344
<divclassName="flex items-center gap-4">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp