Commit 9033450a authored by yuguo's avatar yuguo

fix

parent f5410548
......@@ -23,7 +23,8 @@
"Bash(npm:*)",
"Bash(./api.exe:*)",
"Bash(PGPASSWORD=123456 psql:*)",
"Bash(go mod:*)"
"Bash(go mod:*)",
"Bash(go vet:*)"
]
}
}
This diff is collapsed.
......@@ -5,7 +5,6 @@ import { Card, Table, Tag, Button, Modal, Form, Input, Select, message, Space, B
import { DeploymentUnitOutlined, PlayCircleOutlined, PlusOutlined, EditOutlined } from '@ant-design/icons';
import { workflowApi } from '@/api/agent';
import VisualWorkflowEditor from '@/components/workflow/VisualWorkflowEditor';
import type { Node, Edge } from '@xyflow/react';
interface Workflow {
id: number;
......@@ -60,7 +59,13 @@ export default function WorkflowsPage() {
},
edges: [{ id: 'e1', source_node: 'start', target_node: 'end' }],
};
await workflowApi.create({ ...values, definition: JSON.stringify(definition) });
await workflowApi.create({
workflow_id: values.workflow_id,
name: values.name,
description: values.description,
category: values.category,
definition: JSON.stringify(definition),
});
message.success('创建成功');
setCreateModal(false);
form.resetFields();
......@@ -72,7 +77,8 @@ export default function WorkflowsPage() {
}
};
const handleSaveWorkflow = useCallback(async (nodes: Node[], edges: Edge[]) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleSaveWorkflow = useCallback(async (nodes: any[], edges: any[]) => {
if (!editingWorkflow) return;
try {
await workflowApi.update(editingWorkflow.id, { definition: JSON.stringify({ nodes, edges }) });
......@@ -81,7 +87,8 @@ export default function WorkflowsPage() {
} catch { message.error('保存失败'); }
}, [editingWorkflow]);
const handleExecuteFromEditor = useCallback(async (nodes: Node[], edges: Edge[]) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleExecuteFromEditor = useCallback(async (nodes: any[], edges: any[]) => {
if (!editingWorkflow) return;
try {
const result = await workflowApi.execute(editingWorkflow.workflow_id, { workflow_data: { nodes, edges } });
......@@ -96,7 +103,7 @@ export default function WorkflowsPage() {
} catch { message.error('执行失败'); }
};
const getEditorInitialData = (): { nodes?: Node[]; edges?: Edge[] } | undefined => {
const getEditorInitialData = (): { nodes?: unknown[]; edges?: unknown[] } | undefined => {
if (!editingWorkflow?.definition) return undefined;
try { return JSON.parse(editingWorkflow.definition); } catch { return undefined; }
};
......@@ -193,10 +200,14 @@ export default function WorkflowsPage() {
<div style={{ height: 650 }}>
<VisualWorkflowEditor
workflowName={editingWorkflow?.name || '编辑工作流'}
initialNodes={getEditorInitialData()?.nodes}
initialEdges={getEditorInitialData()?.edges}
onSave={handleSaveWorkflow}
onExecute={handleExecuteFromEditor}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
initialNodes={getEditorInitialData()?.nodes as any}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
initialEdges={getEditorInitialData()?.edges as any}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onSave={handleSaveWorkflow as any}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onExecute={handleExecuteFromEditor as any}
/>
</div>
</Modal>
......
......@@ -8,6 +8,7 @@ import {
HeartOutlined,
MessageOutlined,
} from '@ant-design/icons';
import { usePathname } from 'next/navigation';
import { useUserStore } from '../../store/userStore';
import { useAIAssistStore } from '../../store/aiAssistStore';
import ChatPanel from './ChatPanel';
......@@ -15,6 +16,7 @@ import ChatPanel from './ChatPanel';
const FloatContainer: React.FC = () => {
const { user } = useUserStore();
const { isOpen, patientContext, openDrawer, closeDrawer } = useAIAssistStore();
const pathname = usePathname();
if (!user) return null;
......@@ -22,6 +24,9 @@ const FloatContainer: React.FC = () => {
const isPatient = user.role === 'patient';
if (!isDoctor && !isPatient) return null;
// Hide on doctor consult page — it has its own integrated AI panel
if (isDoctor && pathname?.includes('/doctor/consult')) return null;
const primaryColor = isPatient
? 'linear-gradient(135deg, #22c55e, #06b6d4)'
: 'linear-gradient(135deg, #3b82f6, #8b5cf6)';
......
......@@ -40,6 +40,7 @@ interface NodeData {
label: string;
nodeType: NodeType;
config?: Record<string, unknown>;
[key: string]: unknown;
}
const NODE_CONFIGS: { type: NodeType; label: string; icon: React.ReactNode; color: string; bgColor: string }[] = [
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment