Skip to content

Commit 2bbe3bf

Browse files
committed
feat: 知识库组件结构调整
1 parent 7852136 commit 2bbe3bf

4 files changed

Lines changed: 27 additions & 50 deletions

File tree

src/frontend/platform/src/components/bs-comp/chatComponent/RunLog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function RunLog({ data }) {
4545
+ assistantState.flow_list.length === 0) return null
4646

4747
return <div className="py-1">
48-
<div className="rounded-sm border">
48+
<div className="rounded-sm border max-w-[90%]">
4949
<div className="flex justify-between items-center px-4 py-2 cursor-pointer" onClick={() => setOpen(!open)}>
5050
<div className="flex items-center font-bold gap-2 text-sm">
5151
{

src/frontend/platform/src/pages/BuildPage/bench/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export default function index() {
197197
}}
198198
/>
199199
<FormInput
200-
label={<Label className="bisheng-label block pt-2">最大字符数</Label>}
200+
label={<Label className="bisheng-label block pt-2">知识库、联网检索结果最大字符数</Label>}
201201
type="number"
202202
value={formData.maxTokens}
203203
error={''}

src/frontend/platform/src/pages/KnowledgePage/components/FileUploadStep2.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@ interface FileItem {
2323
fileType: 'table' | 'file';
2424
}
2525
interface IProps {
26-
fileInfo: { fileCount: number, files: any, failFiles: any }
27-
setShowSecondDiv: (show: boolean) => void
28-
onPrev: () => void
29-
onPreview: (data: any, files: any) => void
30-
onChange: () => void
26+
step: number
3127
resultFiles: FileItem[]
28+
onNext: (config: any) => void
3229
}
3330

34-
export default function FileUploadStep2({ fileInfo, onPrev, resultFiles, onPreview, onChange }: IProps) {
31+
export default function FileUploadStep2({ step, resultFiles, onNext }: IProps) {
3532
const { id: kid } = useParams()
3633
const { t } = useTranslation('knowledge')
3734

@@ -217,7 +214,6 @@ export default function FileUploadStep2({ fileInfo, onPrev, resultFiles, onPrevi
217214
console.log('Preview params:', params)
218215

219216
setShowSecondDiv(true)
220-
onPreview(params, fileInfo)
221217
}
222218
return <div className="flex flex-row">
223219
<div className={showSecondDiv ? "w-1/2 pr-2 overflow-y-auto" : "w-full overflow-y-auto"}>

src/frontend/platform/src/pages/KnowledgePage/filesUpload.tsx

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
import { Button } from "@/components/bs-ui/button";
12
import StepProgress from "@/components/bs-ui/step";
2-
import ShadTooltip from "@/components/ShadTooltipComponent";
3-
import { ArrowLeft, ChevronLeft, FileText } from "lucide-react";
4-
import { useRef, useState } from "react";
3+
import { ChevronLeft } from "lucide-react";
4+
import { useState } from "react";
55
import { useTranslation } from "react-i18next";
66
import { useNavigate } from "react-router-dom";
77
import FileUploadStep1 from "./components/FileUploadStep1";
88
import FileUploadStep2 from "./components/FileUploadStep2";
9-
import { Button } from "@/components/bs-ui/button";
109

1110
const StepLabels = [
1211
'上传文件',
@@ -18,36 +17,21 @@ const StepLabels = [
1817
export default function FilesUpload() {
1918
const { t } = useTranslation('knowledge')
2019
const navigate = useNavigate();
21-
const [stepEnd, setStepEnd] = useState(false)
22-
23-
const [change, setChange] = useState(false)
24-
25-
const [showView, setShowView] = useState(false)
26-
const viewRef = useRef(null)
27-
const handlePreviewClick = (data, files) => {
28-
setChange(false)
29-
setShowView(true)
30-
console.log('5678', files);
31-
32-
viewRef.current.load(data, files)
33-
}
3420

35-
const [fileInfo, setFileInfo] = useState(null)
36-
37-
///// new
3821
const [currentStep, setCurrentStep] = useState(1)
3922
const [resultFiles, setResultFiles] = useState([])
4023
console.log('resultFiles :>> ', resultFiles);
4124
// 策略配置
4225
const [config, setConfig] = useState(null)
4326

44-
const handleSave = (_files) => {
27+
// 直接保存
28+
const handleFinishUpload = (_files) => {
4529
const files = resultFiles || _files
4630
console.log(' todo resultFiles :>> ', files);
31+
// TODO: 保存后返回上一页
4732
}
48-
const [showSecondDiv, setShowSecondDiv] = useState(false);
33+
4934
return <div className="relative h-full flex flex-col">
50-
{/* 固定在上方的进度条 */}
5135
<div className="pt-4 px-4">
5236
<div className="flex items-center">
5337
<Button
@@ -60,43 +44,40 @@ export default function FilesUpload() {
6044
</Button>
6145
<span className="text-foreground text-sm font-black pl-4">{t('back')}</span>
6246
</div>
47+
{/* 固定在上方的步进条 */}
6348
<StepProgress
64-
currentStep={currentStep}
6549
align="center"
50+
currentStep={currentStep}
6651
labels={StepLabels}
67-
className="mt-4"
6852
/>
6953
</div>
7054

71-
{/* 主要内容区域 - 使用flex布局分成两部分 */}
55+
{/* 主要内容区域*/}
7256
<div className="flex flex-1 overflow-hidden px-4 pb-16"> {/* pb-16为底部按钮留空间 */}
73-
{/* 左侧文件上传区域 */}
7457
<div className="w-full overflow-y-auto">
7558
<div className="h-full">
7659

77-
<FileUploadStep1 hidden={currentStep !== 1}
60+
<FileUploadStep1
61+
hidden={currentStep !== 1}
7862
onNext={(files) => {
79-
setFileInfo(files);
8063
setResultFiles(files);
8164
setCurrentStep(2);
8265
}}
8366
onSave={(files) => {
8467
setResultFiles(files);
85-
handleSave(files);
68+
handleFinishUpload(files);
8669
}}
8770
/>
8871

89-
{currentStep === 2 && (
90-
<FileUploadStep2
91-
resultFiles={resultFiles}
92-
fileInfo={fileInfo}
93-
setShowSecondDiv={setShowSecondDiv}
94-
onPrev={() => setStepEnd(false)}
95-
onPreview={handlePreviewClick}
96-
onChange={() => setChange(true)}
97-
/>
98-
)}
99-
{currentStep === 3 && <div>1111</div>}
72+
<FileUploadStep2
73+
step={currentStep}
74+
resultFiles={resultFiles}
75+
onNext={(_config) => {
76+
setConfig(_config);
77+
setCurrentStep(4);
78+
}}
79+
/>
80+
{currentStep === 4 && <div>数据处理</div>}
10081
</div>
10182
</div>
10283
</div>

0 commit comments

Comments
 (0)