Commit 9033450a authored by yuguo's avatar yuguo

fix

parent f5410548
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
"Bash(npm:*)", "Bash(npm:*)",
"Bash(./api.exe:*)", "Bash(./api.exe:*)",
"Bash(PGPASSWORD=123456 psql:*)", "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 ...@@ -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 { DeploymentUnitOutlined, PlayCircleOutlined, PlusOutlined, EditOutlined } from '@ant-design/icons';
import { workflowApi } from '@/api/agent'; import { workflowApi } from '@/api/agent';
import VisualWorkflowEditor from '@/components/workflow/VisualWorkflowEditor'; import VisualWorkflowEditor from '@/components/workflow/VisualWorkflowEditor';
import type { Node, Edge } from '@xyflow/react';
interface Workflow { interface Workflow {
id: number; id: number;
...@@ -60,7 +59,13 @@ export default function WorkflowsPage() { ...@@ -60,7 +59,13 @@ export default function WorkflowsPage() {
}, },
edges: [{ id: 'e1', source_node: 'start', target_node: 'end' }], 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('创建成功'); message.success('创建成功');
setCreateModal(false); setCreateModal(false);
form.resetFields(); form.resetFields();
...@@ -72,7 +77,8 @@ export default function WorkflowsPage() { ...@@ -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; if (!editingWorkflow) return;
try { try {
await workflowApi.update(editingWorkflow.id, { definition: JSON.stringify({ nodes, edges }) }); await workflowApi.update(editingWorkflow.id, { definition: JSON.stringify({ nodes, edges }) });
...@@ -81,7 +87,8 @@ export default function WorkflowsPage() { ...@@ -81,7 +87,8 @@ export default function WorkflowsPage() {
} catch { message.error('保存失败'); } } catch { message.error('保存失败'); }
}, [editingWorkflow]); }, [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; if (!editingWorkflow) return;
try { try {
const result = await workflowApi.execute(editingWorkflow.workflow_id, { workflow_data: { nodes, edges } }); const result = await workflowApi.execute(editingWorkflow.workflow_id, { workflow_data: { nodes, edges } });
...@@ -96,7 +103,7 @@ export default function WorkflowsPage() { ...@@ -96,7 +103,7 @@ export default function WorkflowsPage() {
} catch { message.error('执行失败'); } } catch { message.error('执行失败'); }
}; };
const getEditorInitialData = (): { nodes?: Node[]; edges?: Edge[] } | undefined => { const getEditorInitialData = (): { nodes?: unknown[]; edges?: unknown[] } | undefined => {
if (!editingWorkflow?.definition) return undefined; if (!editingWorkflow?.definition) return undefined;
try { return JSON.parse(editingWorkflow.definition); } catch { return undefined; } try { return JSON.parse(editingWorkflow.definition); } catch { return undefined; }
}; };
...@@ -193,10 +200,14 @@ export default function WorkflowsPage() { ...@@ -193,10 +200,14 @@ export default function WorkflowsPage() {
<div style={{ height: 650 }}> <div style={{ height: 650 }}>
<VisualWorkflowEditor <VisualWorkflowEditor
workflowName={editingWorkflow?.name || '编辑工作流'} workflowName={editingWorkflow?.name || '编辑工作流'}
initialNodes={getEditorInitialData()?.nodes} // eslint-disable-next-line @typescript-eslint/no-explicit-any
initialEdges={getEditorInitialData()?.edges} initialNodes={getEditorInitialData()?.nodes as any}
onSave={handleSaveWorkflow} // eslint-disable-next-line @typescript-eslint/no-explicit-any
onExecute={handleExecuteFromEditor} 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> </div>
</Modal> </Modal>
......
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
HeartOutlined, HeartOutlined,
MessageOutlined, MessageOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { usePathname } from 'next/navigation';
import { useUserStore } from '../../store/userStore'; import { useUserStore } from '../../store/userStore';
import { useAIAssistStore } from '../../store/aiAssistStore'; import { useAIAssistStore } from '../../store/aiAssistStore';
import ChatPanel from './ChatPanel'; import ChatPanel from './ChatPanel';
...@@ -15,6 +16,7 @@ import ChatPanel from './ChatPanel'; ...@@ -15,6 +16,7 @@ import ChatPanel from './ChatPanel';
const FloatContainer: React.FC = () => { const FloatContainer: React.FC = () => {
const { user } = useUserStore(); const { user } = useUserStore();
const { isOpen, patientContext, openDrawer, closeDrawer } = useAIAssistStore(); const { isOpen, patientContext, openDrawer, closeDrawer } = useAIAssistStore();
const pathname = usePathname();
if (!user) return null; if (!user) return null;
...@@ -22,6 +24,9 @@ const FloatContainer: React.FC = () => { ...@@ -22,6 +24,9 @@ const FloatContainer: React.FC = () => {
const isPatient = user.role === 'patient'; const isPatient = user.role === 'patient';
if (!isDoctor && !isPatient) return null; 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 const primaryColor = isPatient
? 'linear-gradient(135deg, #22c55e, #06b6d4)' ? 'linear-gradient(135deg, #22c55e, #06b6d4)'
: 'linear-gradient(135deg, #3b82f6, #8b5cf6)'; : 'linear-gradient(135deg, #3b82f6, #8b5cf6)';
......
...@@ -40,6 +40,7 @@ interface NodeData { ...@@ -40,6 +40,7 @@ interface NodeData {
label: string; label: string;
nodeType: NodeType; nodeType: NodeType;
config?: Record<string, unknown>; config?: Record<string, unknown>;
[key: string]: unknown;
} }
const NODE_CONFIGS: { type: NodeType; label: string; icon: React.ReactNode; color: string; bgColor: string }[] = [ 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