diff --git a/.python-version b/.python-version deleted file mode 100644 index 24ee5b1..0000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.13 diff --git a/frontend/src/components/Chat/LeftPanel.tsx b/frontend/src/components/Chat/LeftPanel.tsx index 30be8ac..d5e91a9 100644 --- a/frontend/src/components/Chat/LeftPanel.tsx +++ b/frontend/src/components/Chat/LeftPanel.tsx @@ -98,15 +98,19 @@ export function LeftPanel({ {activeTab === 'chats' ? 'Chat History' : 'Workflows'} - {activeTab === 'chats' && ( - - )} +
@@ -115,7 +119,7 @@ export function LeftPanel({ {loadingWorkflows ? (
Loading workflows...
) : workflows.length === 0 ? ( -
暂无工作流
+
暂无工作流
点击右上角 + 创建
) : ( workflows.map((wf) => (
void; + onSuccess: (traceId: string) => void; +} + +export function NewWorkflowDialog({ onClose, onSuccess }: NewWorkflowDialogProps) { + const [command, setCommand] = useState(''); + const [title, setTitle] = useState(''); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(''); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + if (!command.trim() || !title.trim()) { + setError('标题和需求描述不能为空'); + return; + } + + setLoading(true); + setError(''); + + try { + const response = await apiClient.post('/api/v1/workflow', { + title: title, + command: command + }); + if (response.data && response.data.trace_id) { + onSuccess(response.data.trace_id); + } + } catch (err: any) { + setError(err.response?.data?.message || '创建工作流失败,请重试'); + } finally { + setLoading(false); + } + }; + + return ( +
+
+
+
+ +

新建工作流任务

+
+ +
+ +
+ {error && ( +
+ {error} +
+ )} + +
+ + setTitle(e.target.value)} + placeholder="例如:爬取最新的技术新闻" + className="w-full px-3 py-2 border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500" + autoFocus + /> +
+ +
+ +