Skip to content

Commit b6cd2ae

Browse files
committed
fix: workflowApi typo
1 parent 0b67e8d commit b6cd2ae

2 files changed

Lines changed: 55 additions & 7 deletions

File tree

src/frontend/platform/src/components/bs-comp/apiComponent/ApiAccessFlow.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,9 @@ print(response.text)# 输出工作流的响应`
529529
<div className="mb-6">
530530
<ul className="list-disc list-inside pl-4 mt-2 bisheng-label pb-2">
531531
<li className='mt-2 leading-6'>如果用户在对话框内上传了文件</li>
532-
<li className='mt-2 leading-6'>如果有文件类型,调用毕昇文件上传接口获取到文件url,示例如下:</li>
532+
<ul className="list-disc list-inside pl-4 mt-2 bisheng-label pb-2">
533+
<li className='mt-2 leading-6'>如果有文件类型,调用毕昇文件上传接口获取到文件url,示例如下:</li>
534+
</ul>
533535
</ul>
534536
</div>
535537
<SyntaxHighlighter
@@ -553,15 +555,17 @@ def upload_file(local_path: str):
553555

554556
<div className="mb-6">
555557
<ul className="list-disc list-inside pl-4 mt-2 bisheng-label pb-2">
556-
<li className='mt-2 leading-6'>成功获取用户的输入和上传文件的url后,拼接为如下格式的接口入参</li>
558+
<ul className="list-disc list-inside pl-4 mt-2 bisheng-label pb-2">
559+
<li className='mt-2 leading-6'>成功获取用户的输入和上传文件的url后,拼接为如下格式的接口入参</li>
560+
</ul>
557561
</ul>
558562
</div>
559563
<SyntaxHighlighter
560-
className="w-full overflow-auto custom-scroll"
561-
language={'json'}
562-
style={oneDark}
563-
>
564-
{`payload = json.dumps({
564+
className="w-full overflow-auto custom-scroll"
565+
language={'json'}
566+
style={oneDark}
567+
>
568+
{`payload = json.dumps({
565569
"workflow_id": "c90bb7f2-b7d1-49bf-9fb6-3ab60ff8e414",
566570
"session_id": "d4347ab8e8cd48c48ac9920dbb5a9b35_async_task_id", # 上次返回的 session_id
567571
"message_id": "385140",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
import KnowledgeUploadComponent from "@/components/bs-comp/knowledgeUploadComponent";
3+
import { Button } from "@/components/bs-ui/button";
4+
import { locationContext } from "@/contexts/locationContext";
5+
import { useContext, useRef, useState } from "react";
6+
7+
export default function FileUploadStep1({ hidden, onNext, onSave }) {
8+
// const { t } = useTranslation('knowledge')
9+
const { appConfig } = useContext(locationContext)
10+
11+
const [fileCount, setFileCount] = useState(0)
12+
const [finish, setFinish] = useState(false)
13+
const filesRef = useRef<any>([])
14+
const failFilesRef = useRef<any>([])
15+
16+
const handleFileChange = (files, failFiles) => {
17+
filesRef.current = files.map(file => ({
18+
...file,
19+
fileType: ['xlsx', 'xls', 'csv'].includes(file.fileName.split('.').pop().toLowerCase()) ? 'table' : 'file'
20+
}))
21+
// TODO 提示 failFiles
22+
failFilesRef.current = failFiles
23+
24+
setFinish(true)
25+
}
26+
27+
return <div className={`max-w-[1200px] mx-auto flex flex-col px-10 pt-4 ${hidden ? 'hidden' : ''}`}>
28+
<KnowledgeUploadComponent
29+
size={appConfig.uploadFileMaxSize}
30+
progressClassName='h-[calc(100vh-400px)]'
31+
onSelectFile={(count) => {
32+
setFileCount(count)
33+
setFinish(false)
34+
}}
35+
onFileChange={handleFileChange}
36+
/>
37+
<div className="absolute bottom-2 right-0 flex justify-end gap-4">
38+
<Button disabled={!finish} variant="outline" onClick={() => onSave(filesRef.current)}>直接上传</Button>
39+
<Button disabled={!finish} onClick={() => onNext(filesRef.current)} >
40+
{fileCount ? <span>{fileCount}个文件</span> : null} 下一步</Button>
41+
</div>
42+
</div>
43+
44+
};

0 commit comments

Comments
 (0)