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

Commit2ab771c

Browse files
committed
fix: use default preset when creating a workspace for task
1 parent7387905 commit2ab771c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const TaskFormSection: FC<{
192192
);
193193
};
194194

195-
typeCreateTaskMutationFnProps={prompt:string;templateId:string};
195+
typeCreateTaskMutationFnProps={prompt:string;template:Template};
196196

197197
typeTaskFormProps={
198198
templates:Template[];
@@ -201,25 +201,25 @@ type TaskFormProps = {
201201
constTaskForm:FC<TaskFormProps>=({ templates})=>{
202202
const{ user}=useAuthenticated();
203203
constqueryClient=useQueryClient();
204-
205204
const[templateId,setTemplateId]=useState<string>(templates[0].id);
205+
constselectedTemplate=templates.find(
206+
(t)=>t.id===templateId,
207+
)asTemplate;
206208
const{
207209
externalAuth,
208210
externalAuthPollingState,
209211
startPollingExternalAuth,
210212
isLoadingExternalAuth,
211213
externalAuthError,
212-
}=useExternalAuth(
213-
templates.find((t)=>t.id===templateId)?.active_version_id,
214-
);
214+
}=useExternalAuth(selectedTemplate.active_version_id);
215215

216216
consthasAllRequiredExternalAuth=externalAuth?.every(
217217
(auth)=>auth.optional||auth.authenticated,
218218
);
219219

220220
constcreateTaskMutation=useMutation({
221-
mutationFn:async({ prompt,templateId}:CreateTaskMutationFnProps)=>
222-
data.createTask(prompt,user.id,templateId),
221+
mutationFn:async({ prompt,template}:CreateTaskMutationFnProps)=>
222+
data.createTask(prompt,user.id,template.id,template.active_version_id),
223223
onSuccess:async()=>{
224224
awaitqueryClient.invalidateQueries({
225225
queryKey:["tasks"],
@@ -242,7 +242,7 @@ const TaskForm: FC<TaskFormProps> = ({ templates }) => {
242242
try{
243243
awaitcreateTaskMutation.mutateAsync({
244244
prompt,
245-
templateId:templateID,
245+
template:selectedTemplate,
246246
});
247247
form.reset();
248248
}catch(error){
@@ -533,10 +533,15 @@ export const data = {
533533
prompt:string,
534534
userId:string,
535535
templateId:string,
536+
templateVersionId:string,
536537
):Promise<Task>{
538+
constpresets=awaitAPI.getTemplateVersionPresets(templateVersionId);
539+
constdefaultPreset=presets.find((p)=>p.Default);
537540
constworkspace=awaitAPI.createWorkspace(userId,{
538541
name:`task-${generateWorkspaceName()}`,
539542
template_id:templateId,
543+
template_version_id:templateVersionId,
544+
template_version_preset_id:defaultPreset?.ID,
540545
rich_parameter_values:[
541546
{name:AI_PROMPT_PARAMETER_NAME,value:prompt},
542547
],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp