This commit is contained in:
bipproduction
2025-10-21 16:08:16 +08:00
parent 56cbe3a945
commit 3b772b3018
2 changed files with 4 additions and 4 deletions

View File

@@ -64,9 +64,9 @@ function FlowWaHookList() {
setLoading(false); setLoading(false);
}; };
const setAsDefault = async (id: string) => { const setAsDefault = async (id: string, defaultData: any) => {
setLoading(true); setLoading(true);
const { error } = await apiFetch.api.chatflows.default.put({ id, defaultData: {} }); const { error } = await apiFetch.api.chatflows.default.put({ id, defaultData });
if (error) { if (error) {
showNotification({ title: "Error", message: "Failed to set default flow", color: "red" }); showNotification({ title: "Error", message: "Failed to set default flow", color: "red" });
} else { } else {
@@ -99,7 +99,7 @@ function FlowWaHookList() {
<Table.Td>{flow.name}</Table.Td> <Table.Td>{flow.name}</Table.Td>
<Table.Td>{flow.type}</Table.Td> <Table.Td>{flow.type}</Table.Td>
<Table.Td> <Table.Td>
<Checkbox checked={defaultFlow === flow.id} onChange={() => setAsDefault(flow.id)} /> <Checkbox checked={defaultFlow === flow.id} onChange={() => setAsDefault(flow.id, flow)} />
</Table.Td> </Table.Td>
</Table.Tr> </Table.Tr>
))} ))}

View File

@@ -100,7 +100,7 @@ const FlowRoute = new Elysia({
{ {
body: t.Object({ body: t.Object({
id: t.String(), id: t.String(),
defaultData: t.Optional(t.Any()), defaultData: t.Any(),
}), }),
detail: { detail: {
summary: "Update default chatflows", summary: "Update default chatflows",