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

fix: use default preset when creating a workspace for task#18623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
BrunoQuaresma wants to merge1 commit intomain
base:main
Choose a base branch
Loading
frombq/fix-prebuild-for-tasks
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletionssite/src/pages/TasksPage/TasksPage.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -192,7 +192,7 @@ const TaskFormSection: FC<{
);
};

type CreateTaskMutationFnProps = { prompt: string;templateId: string };
type CreateTaskMutationFnProps = { prompt: string;template: Template };

type TaskFormProps = {
templates: Template[];
Expand All@@ -201,25 +201,25 @@ type TaskFormProps = {
const TaskForm: FC<TaskFormProps> = ({ templates }) => {
const { user } = useAuthenticated();
const queryClient = useQueryClient();

const [templateId, setTemplateId] = useState<string>(templates[0].id);
const selectedTemplate = templates.find(
(t) => t.id === templateId,
) as Template;
const {
externalAuth,
externalAuthPollingState,
startPollingExternalAuth,
isLoadingExternalAuth,
externalAuthError,
} = useExternalAuth(
templates.find((t) => t.id === templateId)?.active_version_id,
);
} = useExternalAuth(selectedTemplate.active_version_id);

const hasAllRequiredExternalAuth = externalAuth?.every(
(auth) => auth.optional || auth.authenticated,
);

const createTaskMutation = useMutation({
mutationFn: async ({ prompt,templateId }: CreateTaskMutationFnProps) =>
data.createTask(prompt, user.id,templateId),
mutationFn: async ({ prompt,template }: CreateTaskMutationFnProps) =>
data.createTask(prompt, user.id,template.id, template.active_version_id),
onSuccess: async () => {
await queryClient.invalidateQueries({
queryKey: ["tasks"],
Expand All@@ -242,7 +242,7 @@ const TaskForm: FC<TaskFormProps> = ({ templates }) => {
try {
await createTaskMutation.mutateAsync({
prompt,
templateId: templateID,
template: selectedTemplate,
});
form.reset();
} catch (error) {
Expand DownExpand Up@@ -533,10 +533,15 @@ export const data = {
prompt: string,
userId: string,
templateId: string,
templateVersionId: string,
): Promise<Task> {
const presets = await API.getTemplateVersionPresets(templateVersionId);
const defaultPreset = presets.find((p) => p.Default);
const workspace = await API.createWorkspace(userId, {
name: `task-${generateWorkspaceName()}`,
template_id: templateId,
template_version_id: templateVersionId,
template_version_preset_id: defaultPreset?.ID,
rich_parameter_values: [
{ name: AI_PROMPT_PARAMETER_NAME, value: prompt },
],
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp