Procházet zdrojové kódy

修复信息报错

sunsheng před 1 měsícem
rodič
revize
cf8069cab7

+ 3 - 0
env/.env.development

@@ -5,6 +5,9 @@ VITE_ENV = 'development'
 VITE_API_URL = 'http://172.16.30.146:8090'
 VITE_API_URL_img = 'http://172.16.30.146:8090'
 # VITE_API_URL = 'http://xia0miduo.gicp.net:8041'
+# VITE_API_URL = 'http://192.168.3.3:8091'
+# VITE_API_URL_img = 'http://192.168.3.3'
+# VITE_API_URL = 'http://xia0miduo.gicp.net:8091'
 
 #跳转地址
 VITE_JUMP_URL = 'http://localhost:4000/#/knowledgeChat?showMenu=true&chatMode=LOCAL'

binární
src/assets/login/background.jpg


+ 15 - 9
src/pages/deepseek/knowledgeLib/detail/index.tsx

@@ -200,6 +200,7 @@ const KnowledgeLibInfo : React.FC = () => {
       title: '文件名',
       dataIndex: 'name',
       width: 300,
+      sorter: (a, b) => a.name.localeCompare(b.name),
       render: ( text, record ) => {
         return (
             `${ text }`
@@ -279,8 +280,9 @@ const KnowledgeLibInfo : React.FC = () => {
                   <a
                       style={ { marginRight: 16 } }
                       onClick={ () => {
-                        const path = generatePath( '/deepseek/knowledgeLib/:knowledgeId/slice/:documentId/:embeddingId', {
+                        const path = generatePath( '/deepseek/knowledgeLib/:knowledgeId/:createBy/slice/:documentId/:embeddingId', {
                           knowledgeId: params.knowledgeId as string,
+                          createBy: params.createBy as string,
                           documentId: record.documentId,
                           embeddingId: state.knowledgeDetail.embeddingId,
                         } );
@@ -411,14 +413,18 @@ const KnowledgeLibInfo : React.FC = () => {
                       </Upload>
                   }
                 </div>
-                <Table
-                    scroll={ { x: 'max-content' } }
-                    rowKey={ ( record ) => record.documentId }
-                    loading={ listLoading }
-                    columns={ columns }
-                    dataSource={ list }
-                    pagination={ paginationConfig }
-                />
+                
+                <div className='knowledgeLibInfo-table'>
+                  <Table
+                      scroll={ { x: 'max-content' } }
+                      rowKey={ ( record ) => record.documentId }
+                      loading={ listLoading }
+                      columns={ columns }
+                      dataSource={ list }
+                      pagination={ paginationConfig }
+                  />
+                </div>
+
                 {
                     infoModalOpen &&
                     <InfoModal

+ 6 - 0
src/pages/deepseek/knowledgeLib/detail/style.less

@@ -4,6 +4,12 @@
   background: #FFFFFF;
   border-radius: @border-radius-base;
 
+  &-table {
+    padding: 20px;
+    background: #FFFFFF;
+    border-radius: @border-radius-base;
+  }
+
   &-operation {
     padding: 20px;
     background: #FFFFFF;

+ 4 - 1
src/pages/deepseek/knowledgeLib/list/index.tsx

@@ -75,12 +75,15 @@ const KnowledgeLibList: React.FC = () => {
         {
             title: '知识库名称',
             dataIndex: 'name',
+            sorter: (a, b) => a.name.localeCompare(b.name), 
             render: (text, record) => {
                 if (createFlag) {
                     return (
                         <a href=""
                             onClick={()=>{
-                                router.navigate({ pathname: `/deepseek/knowledgeLib/${record.knowledgeId}` }, { state: { createBy: record.createBy } });
+                                router.navigate({ pathname: `/deepseek/knowledgeLib/${record.knowledgeId}/${record.createBy}`,
+                                 },
+                                      );
                             }}
                         >
                             {text}

+ 12 - 5
src/pages/deepseek/knowledgeLib/slice/detail/index.tsx

@@ -44,7 +44,8 @@ const SliceDetail: React.FC = () => {
     const [form] = Form.useForm();
     const params = useParams();
     const location = useLocation();
-    const { text, page } = location.state;
+    // console.log('location------',location);
+    const { text = '', page } = location.state??{};
     const [listLoading, setListLoading] = React.useState(false);
     const [mdImgUrlList, setMdImgUrlList] = useState<MdImg[]>();
 
@@ -219,12 +220,15 @@ const SliceDetail: React.FC = () => {
                             type='primary'
                             icon={<ArrowLeftOutlined />}
                             onClick={() => {
-                                const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/slice/:documentId/:embeddingId', {
+                                const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/:createBy/slice/:documentId/:embeddingId', {
                                     knowledgeId: params.knowledgeId as string,
                                     documentId: params.documentId as string,
+                                    createBy: params.createBy as string,
                                     embeddingId: params.embeddingId as string,
                                 });
-                                router.navigate({ pathname: path }, { state: { text: text, page } });
+                                router.navigate({ pathname: path }, 
+                                    { state: { text: text, page } }
+                                );
                             }}
                         >
                             返回
@@ -268,12 +272,15 @@ const SliceDetail: React.FC = () => {
                                             message.error('新增失败');
                                         }
                                     }
-                                    const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/slice/:documentId/:embeddingId', {
+                                    const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/:createBy/slice/:documentId/:embeddingId', {
                                         knowledgeId: params.knowledgeId as string,
+                                        createBy: params.createBy as string,
                                         documentId: params.documentId as string,
                                         embeddingId: params.embeddingId as string,
                                     });
-                                    router.navigate({ pathname: path }, { state: { text: text, page } });
+                                    router.navigate({ pathname: path }, {
+                                         state: { text: text, page } 
+                                        });
                                 }).catch((error) => {
                                     console.error(error);
                                 });

+ 11 - 6
src/pages/deepseek/knowledgeLib/slice/index.tsx

@@ -181,14 +181,15 @@ const SliceList: React.FC = () => {
                     </Form>
                     <div>
                         {
-                            (createFlag||userInfoAll.id===location?.state.createBy) &&
+                            (createFlag||userInfoAll.id===params.createBy) &&
                             <Button
                                 style={{ marginRight: 16 }}
                                 type='primary'
                                 icon={<PlusOutlined />}
                                 onClick={() => {
-                                    const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/slice/:documentId/:embeddingId/:sliceId', {
+                                    const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/:createBy/slice/:documentId/:embeddingId/:sliceId', {
                                         knowledgeId: params.knowledgeId as string,
+                                        createBy: params.createBy as string,
                                         documentId: params.documentId as string,
                                         embeddingId: params.embeddingId as string,
                                         sliceId: 'new',
@@ -200,8 +201,9 @@ const SliceList: React.FC = () => {
                             </Button>
                         }
                         <Button type='primary' icon={<ArrowLeftOutlined />} onClick={() => {
-                            const path = generatePath('/deepseek/knowledgeLib/:knowledgeId', {
+                            const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/:createBy', {
                                 knowledgeId: params.knowledgeId as string,
+                                createBy: params.createBy as string,
                             });
                             router.navigate({ pathname: path });
                         }}>
@@ -243,17 +245,20 @@ const SliceList: React.FC = () => {
 
                                                 <div style={{ overflow: 'auto' }}>
                                                     {
-                                                        (updateFlag||userInfoAll.id===location?.state.createBy) &&
+                                                        (updateFlag||userInfoAll.id===params.createBy) &&
                                                         <a
                                                             style={{ marginRight: 20 }}
                                                             onClick={() => {
-                                                                const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/slice/:documentId/:embeddingId/:sliceId', {
+                                                                const path = generatePath('/deepseek/knowledgeLib/:knowledgeId/:createBy/slice/:documentId/:embeddingId/:sliceId', {
                                                                     knowledgeId: params.knowledgeId as string,
+                                                                    createBy: params.createBy as string,
                                                                     documentId: params.documentId as string,
                                                                     embeddingId: params.embeddingId as string,
                                                                     sliceId: item.slice_id,
                                                                 });
                                                                 const { text } = form.getFieldsValue();
+                                                                console.log('text--',text)
+                                                                console.log('page---',page)
                                                                 router.navigate({ pathname: path }, { state: { text: text, page: { pageNum: page.pageNum, pageSize: page.pageSize, total: page.total } } });
                                                             }}>
                                                             <SettingOutlined /> 编辑
@@ -261,7 +266,7 @@ const SliceList: React.FC = () => {
                                                     }
 
                                                     {
-                                                        (deleteFlag||userInfoAll.id===location?.state.createBy) &&
+                                                        (deleteFlag||userInfoAll.id===params.createBy) &&
                                                         <a className='text-error' onClick={() => {
                                                             Modal.confirm({
                                                                 title: '删除',

+ 31 - 26
src/pages/deepseek/questionAnswer/info/index.tsx

@@ -732,14 +732,15 @@ const QuestionAnswerInfo: React.FC = () => {
                                 name='name'
                                 rules={[{ required: true, message: '问答应用名称不能为空' }]}
                             >
-                                <Input placeholder="请输入问答应用名称" className='form-input-large' />
+                                <Input placeholder="请输入问答应用名称" className='form-element-standard' style={{ height: '48px'}}/>
                             </FormItem>
                             <FormItem
                                 label='应用类型'
                                 name='typeId'
                             >
                                 <Select
-                                    className='questionAnswerInfo-content-title'
+                                    className='form-element-select'
+                                    style={{ height: '48px'}}
                                     placeholder='请选择问答应用类型'
                                     onChange={handleAppChange}
                                     allowClear={true}
@@ -765,7 +766,8 @@ const QuestionAnswerInfo: React.FC = () => {
                                             options={appProjectList}
                                             placeholder="请选择项目"
                                             showSearch
-                                            className="questionAnswerInfo-content-title"
+                                            className="form-element-select"
+                                            style={{ height: '48px'}}
                                         />
                                     </FormItem>
                                 </>
@@ -775,7 +777,8 @@ const QuestionAnswerInfo: React.FC = () => {
                                 name='visible'
                             >
                                 <Select
-                                    className='questionAnswerInfo-content-title'
+                                    className='form-element-select'
+                                    style={{ height: '48px'}}
                                     placeholder='请选择是否公开'
                                     allowClear={true}
                                     onChange={(e) => {
@@ -833,12 +836,12 @@ const QuestionAnswerInfo: React.FC = () => {
                             </FormItem>
 
                             <div className='preset-questions'>
-                                <h4>添加预设问题</h4>
+                                <h4>添加引导问题</h4>
                                 <div>
                                     {
                                         inputs.map(input => (
                                             <div key={input.id} className='question-item'>
-                                                <label>问题 {input.id}</label>
+                                                <label>引导问题 {input.id}</label>
                                                 <Input
                                                     className='question-input'
                                                     type="text"
@@ -935,7 +938,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                 </Tooltip>
                             </div>
                             <Splitter style={{ border: '1px solid #f0f0f0', borderRadius: '6px', height: 550 }}>
-                                <Splitter.Panel defaultSize="45%">
+                                <Splitter.Panel defaultSize="35%">
                                     <div className='prompt'>
                                         <div className='prompt-info'>
                                             <div className='prompt-info-text'>
@@ -945,15 +948,15 @@ const QuestionAnswerInfo: React.FC = () => {
                                                     代表知识库中检索到的知识内容,
                                                     <span className='variable-highlight'>{'{{用户}}'}</span>
                                                     代表用户输入的内容。您可以在编写Prompt过程中将变量拼接在合适的位置。
-                                                    <br />
+                                                    {/* <br />
                                                     插入:
                                                     <span className='variable-highlight'>{'{{知识}}'}</span>,
                                                     插入:
-                                                    <span className='variable-highlight'>{'{{用户}}'}</span>。
+                                                    <span className='variable-highlight'>{'{{用户}}'}</span>。 */}
                                                 </Typography.Paragraph>
                                             </div>
                                         </div>
-                                        <Divider style={{ margin: '0' }} />
+                                        {/* 移除 Divider,使用 CSS 边框替代 */}
                                         <div className='prompt-editor-area'>
                                             <FormItem name='prompt'
                                                 initialValue={
@@ -987,11 +990,11 @@ const QuestionAnswerInfo: React.FC = () => {
                                         </div>
                                     </div>
                                 </Splitter.Panel>
-                                <Splitter.Panel defaultSize="25%">
+                                <Splitter.Panel defaultSize="30%">
                                     <div className='flex-center-container'>
                                         <div className='half-width'>
                                             <div className='flex-center-top'>
-                                                欢迎使用 {name}
+                                                欢迎使用 {name || '问答应用'}
                                             </div>
                                             <div className='flex-start pl-20 padding-top-20'>
                                                 <FormItem
@@ -1002,9 +1005,8 @@ const QuestionAnswerInfo: React.FC = () => {
                                                         mode='multiple'
                                                         maxCount={MAX_COUNT}
                                                         showSearch={true}
-                                                        // suffixIcon={suffix}
-                                                        // className='questionAnswerInfo-content-title'
-                                                        placeholder='请选择知识库'
+                                                        className='form-element-select'
+                                                        placeholder='请选择需要引用的知识库'
                                                     >
                                                         {
                                                             knowledgeList.map((item, index) => {
@@ -1024,7 +1026,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                     <Select
                                                         placeholder='请选择模型'
                                                         allowClear={true}
-                                                        className='questionAnswerInfo-content-title'
+                                                        className='form-element-select'
                                                         onChange={(value) => {
                                                             if (value === 'Qwen3-30B') {
                                                                 setIsDeepThinkVisible(true);
@@ -1046,7 +1048,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                     label='深度思考'
                                                     name='isDeepThink'
                                                     rules={[{ required: true, message: '请选择是否深度思考' }]}>
-                                                    <Radio.Group buttonStyle="solid" className='form-control-width'>
+                                                    <Radio.Group buttonStyle="solid" className='form-element-button-group'>
                                                         <Radio.Button value='Y'>是</Radio.Button>
                                                         <Radio.Button value='N'>否</Radio.Button>
                                                     </Radio.Group>
@@ -1058,7 +1060,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                     name='max_token'
                                                     rules={[{ required: true, message: 'max token不能为空' }]}>
                                                     <InputNumber
-                                                        className='questionAnswerInfo-content-title'
+                                                        className='form-element-input-number'
                                                     />
                                                 </FormItem>
                                             </div>
@@ -1083,7 +1085,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                             <FormItem
                                                                 label='Top-p'
                                                                 name='topP'
-                                                                className='form-control-width'
+                                                                className='form-element-standard'
                                                             >
                                                                 <TopPDecimalStep />
                                                             </FormItem>
@@ -1092,7 +1094,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                             <FormItem
                                                                 label='Temperature'
                                                                 name='temperature'
-                                                                className='form-control-width'
+                                                                className='form-element-standard'
                                                             >
                                                                 <TempDecimalStep />
                                                             </FormItem>
@@ -1110,7 +1112,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                         name='param_desc'
                                                         rules={[{ required: true, message: '回答风格不能为空' }]}>
                                                         <Radio.Group buttonStyle="solid"
-                                                            className='form-control-width'>
+                                                            className='form-element-button-group'>
                                                             <Radio.Button onClick={() => {
                                                                 handleRedioClick('strict')
                                                             }} value='strict'>严谨</Radio.Button>
@@ -1139,7 +1141,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                     <FormItem
                                                         label='展示引用知识'
                                                         name='show_recall_result'
-                                                        className='form-control-width'>
+                                                        className='form-element-standard'>
                                                         <Switch onChange={onChangeShow} />
                                                     </FormItem>
                                                 </div>
@@ -1200,7 +1202,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                                                 placeholder='请选择模型'
                                                             // defaultValue={'rerank'}
                                                             >
-                                                                <Option value='rerank'>默认rerank模型</Option>
+                                                                <Option value='rerank'>默认Rerank模型</Option>
                                                             </Select>
                                                         </FormItem>
                                                     </div>
@@ -1215,7 +1217,8 @@ const QuestionAnswerInfo: React.FC = () => {
                                                         name='slice_config_type'
                                                         rules={[{ required: true, message: '召回方式不能为空' }]}>
                                                         <Select
-                                                            className='questionAnswerInfo-content-title'
+                                                            // className='questionAnswerInfo-content-title'
+                                                            className='form-element-select'
                                                             placeholder='请选择'
                                                             onChange={onChangeCount}>
                                                             <Option value="fixed">手动设置</Option>
@@ -1235,7 +1238,9 @@ const QuestionAnswerInfo: React.FC = () => {
                                                             name='slice_count'
                                                             rules={[{ required: true, message: '切片数不能为空' }]}>
                                                             <InputNumber max={1024} changeOnWheel
-                                                                className='questionAnswerInfo-content-title' />
+                                                                // className='questionAnswerInfo-content-title'
+                                                                className='form-element-standard'
+                                                            />
                                                         </FormItem>
                                                     </div>
                                                 }
@@ -1260,7 +1265,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                         </div>
                                     </div>
                                 </Splitter.Panel>
-                                {appId && (<Splitter.Panel defaultSize="30%">
+                                {appId && (<Splitter.Panel defaultSize="35%">
                                     <Chat appId={appId} />
                                 </Splitter.Panel>)}
                             </Splitter>

+ 85 - 2
src/pages/deepseek/questionAnswer/info/style.less

@@ -64,6 +64,7 @@
       width: 100%;
       min-height: 100%;
       background: #f5f5f5;
+      // 移除浅灰色背景,让父级背景色生效
     }
 
     display: flex;
@@ -170,6 +171,7 @@
     &-large {
       width: 100%;
       max-width: 646px;
+      height: 48px;
       padding: 8px;
     }
 
@@ -181,12 +183,89 @@
 
   &-textarea {
     &-large {
-      height: 120px;
+      height: 96px;
       resize: none;
       width: 100%;
+      min-width: 200px;
       max-width: 646px;
     }
   }
+
+  // 统一表单元素宽度样式
+  &-element {
+    &-standard {
+      width: 100%;
+      max-width: 646px;
+      min-width: 200px;
+    }
+
+    &-full-width {
+      width: 100%;
+    }
+
+    &-button-group {
+      width: 100%;
+      max-width: 646px;
+      display: flex;
+      
+      .ant-radio-group {
+        width: 100%;
+        display: flex;
+        
+        .ant-radio-button-wrapper {
+          flex: 1;
+          text-align: center;
+        }
+      }
+    }
+
+    &-select {
+      width: 100%;
+      max-width: 646px;
+      min-width: 200px;
+    }
+
+    &-input-number {
+      width: 100%;
+      max-width: 646px;
+      min-width: 200px;
+    }
+  }
+}
+
+// Splitter 面板背景样式
+.ant-splitter-panel {
+  &:first-child {
+    // 左侧 35% 区域 - Prompt 区域
+    background: #f5f5f5;
+  }
+  
+  &:nth-child(2) {
+    // 中间 30% 区域 - 配置区域
+    background: #f5f5f5;
+  }
+  
+  &:last-child {
+    // 右侧 35% 区域 - 聊天区域保持白色背景
+    background: #ffffff;
+  }
+}
+
+// 更多设置区域统一样式
+.more-settings-section {
+  padding-top: 20px;
+  
+  .flex-center {
+    margin-bottom: 20px;
+  }
+  
+  .section-title {
+    font-size: 16px;
+    font-weight: 600;
+    color: #303133;
+    text-align: center;
+    margin: 20px 0;
+  }
 }
 
 // 文本区域样式
@@ -291,6 +370,8 @@
     display: flex;
     justify-content: space-between;
     align-items: flex-start;
+    // background: #f5f5f5;
+    // border-bottom: 1px solid #fff;
 
     &-text {
       // 说明文本
@@ -299,7 +380,7 @@
         color: #1890ff;
         font-weight: 500;
         padding: 2px 6px;
-        border-radius: 4px;
+        border-radius: 1px;
         font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
         margin: 0 2px;
       }
@@ -311,6 +392,8 @@
     flex: 1;
     display: flex;
     flex-direction: column;
+    // background: #ffffff;
+    // border-top: none; // 移除顶部边框,避免与 prompt-info 的底部边框重叠
 
     .ant-form-item {
       margin-bottom: 0;

+ 3 - 3
src/router.tsx

@@ -81,7 +81,7 @@ const routerList: RouteObject[] = [
                         element: lazyLoad(() => import('@/pages/deepseek/knowledgeLib/list/index')),
                     },
                     {   /* 知识库-知识库详情 */
-                        path: '/deepseek/knowledgeLib/:knowledgeId',
+                        path: '/deepseek/knowledgeLib/:knowledgeId/:createBy',
                         handle: {
                             menuLevel: 1,
                             breadcrumbName: '知识库详情',
@@ -92,7 +92,7 @@ const routerList: RouteObject[] = [
                                 element: lazyLoad(() => import('@/pages/deepseek/knowledgeLib/detail/index'))
                             },
                             {   /* 知识库-知识库详情-切片信息 */
-                                path: '/deepseek/knowledgeLib/:knowledgeId/slice/:documentId/:embeddingId',
+                                path: '/deepseek/knowledgeLib/:knowledgeId/:createBy/slice/:documentId/:embeddingId',
                                 handle: {
                                     menuLevel: 1,
                                     breadcrumbName: '切片信息',
@@ -103,7 +103,7 @@ const routerList: RouteObject[] = [
                                         element: lazyLoad(() => import('@/pages/deepseek/knowledgeLib/slice/index')),
                                     },
                                     {   /* 知识库-知识库详情-切片信息-切片详情 */
-                                        path: '/deepseek/knowledgeLib/:knowledgeId/slice/:documentId/:embeddingId/:sliceId',
+                                        path: '/deepseek/knowledgeLib/:knowledgeId/:createBy/slice/:documentId/:embeddingId/:sliceId',
                                         handle: {
                                             menuLevel: 1,
                                             breadcrumbName: '切片详情',