李富豪 3 hónapja
szülő
commit
7d0832e1f0

+ 1 - 1
env/.env.development

@@ -2,4 +2,4 @@
 VITE_ENV = 'development'
 
 # Api地址
-VITE_API_URL = 'http://192.168.3.3:8091'
+VITE_API_URL = 'http://192.168.3.123:8091'

+ 3 - 1
src/apis/index.ts

@@ -20,6 +20,7 @@ export type FetchAppListApiParams = {
     userId: string,
     typeId: any,
     projectId: any,
+    keyword: string,
 };
 
 export type FetchKnowledgeLibListApiParams = {
@@ -39,6 +40,7 @@ export type FetchAppIndexParams = {
     userId: string,
     typeId: any,
     projectId: any,
+    keyword: string,
 };
 
 export type CreateOrModifyApplicationApiParams = {
@@ -185,7 +187,7 @@ export type FetchTakaiProjectApi = () => Promise<any>;
 
 // token联登校验
 const checkTokenApi: CheckTokenApi = async (token) => {
-    return api.get(`/checkToken/${token}` );
+    return api.get(`/checkToken/${token}`);
 };
 
 // 建科登录

+ 228 - 237
src/pages/deepseek/questionAnswer/info/index.tsx

@@ -5,7 +5,8 @@ import './style.less';
 import {
     Button, Input, Form, Divider, Splitter, Select, InputNumber, InputNumberProps,
     Radio, Switch, Row, Col, Slider, Space, RadioChangeEvent,
-    Spin, message, Typography, Tooltip
+    Spin, message, Typography, Tooltip,
+    Cascader
 } from 'antd';
 import { PlusCircleOutlined, MinusCircleOutlined, ArrowLeftOutlined, InfoCircleOutlined } from '@ant-design/icons';
 import { apis } from '@/apis';
@@ -99,6 +100,7 @@ const QuestionAnswerInfo: React.FC = () => {
         label: string,
         value: string,
     }[];
+
     type KnowledgeList = {
         label: string,
         value: string,
@@ -107,6 +109,10 @@ const QuestionAnswerInfo: React.FC = () => {
     type AppTypeList = {
         label: string,
         value: string,
+        children: {
+            label: string,
+            value: string,
+        }[],
     }[];
 
     const [step, setStep] = React.useState(1);
@@ -124,7 +130,6 @@ const QuestionAnswerInfo: React.FC = () => {
     const [createFlag, setCreateFlag] = React.useState<boolean>();
     const [appProjectList, setAppProjectList] = React.useState<AppTypeList>([]);
     const [isAppPro, setIsAppPro] = React.useState<boolean>(false);
-    const [selectedAppProId, setSelectedAppProId] = React.useState<string | undefined>(undefined); // 新增状态变量用于绑定 Select 值
 
     const style: React.CSSProperties = {
         display: 'flex',
@@ -214,8 +219,7 @@ const QuestionAnswerInfo: React.FC = () => {
         fetchDetail: async (app_id: string) => {
             setPageLoading(true);
             try {
-                const res = await apis.fetchTakaiApplicationDetail(app_id)
-                console.log(res.data);
+                const res = await apis.fetchTakaiApplicationDetail(app_id);
                 const sd = res.data.questionlist.map((item: any, index: number) => {
                     return {
                         "id": index + 1,
@@ -263,13 +267,13 @@ const QuestionAnswerInfo: React.FC = () => {
                     setIsVisibleSlice(false);
                 }
 
-                if(info.typeId === 42 || info.typeId === 43){
+                if (info.typeId === 41) {
                     setIsAppPro(true);
-                }else{
+                } else {
                     setIsAppPro(false);
                 }
 
-                if(info.model === 'Qwen3-30B') {
+                if (info.model === 'Qwen3-30B') {
                     setIsDeepThinkVisible(true);
                 } else {
                     setIsDeepThinkVisible(false);
@@ -289,9 +293,8 @@ const QuestionAnswerInfo: React.FC = () => {
                     questionList: sd, //问题列表
                     max_token: info.maxToken, //应用最大token
                     updateDate: info.updateDate, // 更新时间
-                    appProId: info.typeId, //项目级应用类型
-                    typeId: info.typeId === 42 || info.typeId === 43 ? 41 : info.typeId, //应用类型
-
+                    appProId: info.appProId,// 项目
+                    typeId: info.typeId, //应用类型
                     param_desc: data_info.param_desc, //回答风格
                     show_recall_result: data_info.show_recall_result, //是否展示召回结果
                     recall_method: data_info.recall_method, //召回方式
@@ -300,7 +303,6 @@ const QuestionAnswerInfo: React.FC = () => {
                     slice_config_type: data_info.slice_config_type, // 召回切片数量
                     slice_count: data_info.slice_count, // 切片数量
                     recall_slice_splicing_method: data_info.recall_slice_splicing_method, // 切片内容
-
                     // rerank_status = 1 rerank_index_type_list
                     // recall_method = 'embedding' || 'mixed'  recall_index_type_list
                     //recall_index_type_list: info.recall_index_type_list, //知识库id
@@ -367,20 +369,13 @@ const QuestionAnswerInfo: React.FC = () => {
         // 项目级应用下的类型
         fetchAppProType: async () => {
             try {
-                const res = await apis.fetchTakaiAppTypeList('project_type');
-                const list = res.data.map((item: any) => {
-                    return {
-                        label: item.dictLabel,
-                        value: item.dictCode,
-                    }
-                });
-                console.log(list, 'project_type');
+                const res = await apis.fetchTakaiAppTypeList('projectTree');
+                const list: AppTypeList = res.data;
                 setAppProjectList(list);
             } catch (error: any) {
                 console.error(error);
             }
         },
-
     }
 
     const handleRedioClick = (value: string) => {
@@ -444,27 +439,21 @@ const QuestionAnswerInfo: React.FC = () => {
                                 }
                             </Select>
                         </FormItem>
-
                         {
                             isAppPro &&
-                            <FormItem
-                                label='类型'
-                                name='appProId'
-                                rules={[{ required: true, message: '项目类型不能为空' }]}
-                            >
-                                <Select
-                                    className='questionAnswerInfo-content-title'
-                                    placeholder='请选择项目类型'
-                                    value={selectedAppProId}
-                                    onChange={(value) => setSelectedAppProId(value)}
+                            <>
+                                <FormItem
+                                    label='项目'
+                                    name='appProId'
+                                    rules={[{ required: true, message: '项目不能为空' }]}
                                 >
-                                    {appProjectList.map((item, index) => (
-                                        <Option value={item.value} key={index}>
-                                            {item.label}
-                                        </Option>
-                                    ))}
-                                </Select>
-                            </FormItem>
+                                    <Cascader
+                                        options={appProjectList}
+                                        placeholder="请选择项目"
+                                        showSearch
+                                    />
+                                </FormItem>
+                            </>
                         }
 
                         <FormItem
@@ -501,7 +490,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                     ))}
                             </div>
                         </div>
-                        
+
                         <div style={{ display: 'flex', gap: '12px', marginTop: '24px', paddingTop: '24px', borderTop: '1px solid #f0f0f0' }}>
                             <Button
                                 className='btn-cancel'
@@ -511,8 +500,8 @@ const QuestionAnswerInfo: React.FC = () => {
                             >
                                 返回
                             </Button>
-                            <Button 
-                                type='primary' 
+                            <Button
+                                type='primary'
                                 onClick={() => {
                                     form.validateFields(['name', 'desc', 'appProId']).then(async (values) => {
                                         setStep(2);
@@ -595,7 +584,6 @@ const QuestionAnswerInfo: React.FC = () => {
                                                 };
                                                 // const knowledgeIds: string[] = [];
                                                 // knowledgeIds.push(values.knowledge_ids);
-                                                console.log(values.appProId , 'values.appProId ');
                                                 const info = {
                                                     id: values.id,
                                                     name: values.name,  //应用名称
@@ -606,13 +594,14 @@ const QuestionAnswerInfo: React.FC = () => {
                                                     knowledge_ids: values.knowledge_ids,
                                                     slice_count: values.slice_count,
                                                     model: values.model,
-                                                    isDeepThink:values.isDeepThink,
+                                                    isDeepThink: values.isDeepThink,
                                                     icon_color: values.icon_color,
                                                     icon_type: values.icon_type,
                                                     questionList: question,
                                                     knowledge_info: JSON.stringify(data_info),
                                                     max_token: values.max_token, //应用最大token
-                                                    typeId:  values.appProId === 42 || values.appProId === 43 ? values.appProId : values.typeId, // 应用类型
+                                                    typeId: values.typeId, // 应用类型
+                                                    appProId: values.appProId,// 项目
                                                     userId: userId, // 用户id
                                                 };
                                                 console.log(info, 'info data');
@@ -642,14 +631,16 @@ const QuestionAnswerInfo: React.FC = () => {
                                                 });
                                             });
                                         }}
-                                    >提交应用</Button>
+                                    >
+                                        提交应用
+                                    </Button>
                                 )}
                             </div>
                         </div>
                         <div className='section-title'>
                             Prompt编写与参数配置
-                            <Tooltip 
-                                title="Prompt用于对大模型的回复做出一些列指令和约束。这段Prompt不会被用户看到。" 
+                            <Tooltip
+                                title="Prompt用于对大模型的回复做出一些列指令和约束。这段Prompt不会被用户看到。"
                                 placement="right"
                                 overlayStyle={{ fontSize: '12px' }}
                             >
@@ -663,8 +654,8 @@ const QuestionAnswerInfo: React.FC = () => {
                                         <div className='prompt-info-text'>
                                             <Typography.Paragraph style={{ fontSize: '12px', lineHeight: '1.6', color: '#999', margin: 0 }}>
                                                 编写Prompt过程中可以引入2项变量:
-                                                <span className='variable-highlight'>{'{{知识}}'}</span> 
-                                                代表知识库中检索到的知识内容, 
+                                                <span className='variable-highlight'>{'{{知识}}'}</span>
+                                                代表知识库中检索到的知识内容,
                                                 <span className='variable-highlight'>{'{{用户}}'}</span>
                                                 代表用户输入的内容。您可以在编写Prompt过程中将变量拼接在合适的位置。
                                                 <br />
@@ -742,7 +733,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                             <FormItem
                                                 label='调用模型'
                                                 name="model"
-                                                rules={[{required: true, message: '模型不能为空'}]}>
+                                                rules={[{ required: true, message: '模型不能为空' }]}>
                                                 <Select
                                                     placeholder='请选择模型'
                                                     allowClear={true}
@@ -760,227 +751,227 @@ const QuestionAnswerInfo: React.FC = () => {
                                                 </Select>
 
                                             </FormItem>
+                                        </div>
+                                        <div className='flex-center' style={{
+                                            display: isDeepThinkVisible ? 'flex' : 'none'
+                                        }}>
+                                            <FormItem
+                                                label='深度思考'
+                                                name='isDeepThink'
+                                                rules={[{ required: true, message: '请选择是否深度思考' }]}>
+                                                <Radio.Group buttonStyle="solid" className='form-control-width'>
+                                                    <Radio.Button value='Y'>是</Radio.Button>
+                                                    <Radio.Button value='N'>否</Radio.Button>
+                                                </Radio.Group>
+                                            </FormItem>
+                                        </div>
+                                        <div className='flex-center'>
+                                            <FormItem
+                                                label='max token'
+                                                name='max_token'
+                                                rules={[{ required: true, message: 'max token不能为空' }]}>
+                                                <InputNumber
+                                                    className='questionAnswerInfo-content-title'
+                                                />
+                                            </FormItem>
+                                        </div>
+
+                                        {
+                                            !isVisible &&
+                                            <div className='flex-center'>
+                                                <a onClick={() => {
+                                                    setIsVisible(!isVisible);
+                                                }} className='link-more-settings'>
+                                                    更多设置
+                                                </a>
                                             </div>
-                                            <div className='flex-center' style={{
-                                                display: isDeepThinkVisible  ? 'flex' : 'none'
+
+                                        }
+
+                                        {/* {isVisible && */}
+                                        <div style={{ display: isVisible ? 'block' : 'none', paddingTop: '20px' }}>
+                                            {isVisibleCus &&
+                                                <Space style={{ width: '100%' }} direction="vertical">
+                                                    <div className='flex-center'>
+                                                        <FormItem
+                                                            label='Top-p'
+                                                            name='topP'
+                                                            className='form-control-width'
+                                                        >
+                                                            <TopPDecimalStep />
+                                                        </FormItem>
+                                                    </div>
+                                                    <div className='flex-center'>
+                                                        <FormItem
+                                                            label='Temperature'
+                                                            name='temperature'
+                                                            className='form-control-width'
+                                                        >
+                                                            <TempDecimalStep />
+                                                        </FormItem>
+                                                    </div>
+                                                </Space>
+                                            }
+
+                                            <div style={{
+                                                display: 'flex',
+                                                justifyContent: 'center',
+                                                alignItems: 'center'
                                             }}>
                                                 <FormItem
-                                                    label='深度思考'
-                                                    name='isDeepThink'
-                                                    rules={[{ required: true, message: '请选择是否深度思考' }]}>
-                                                    <Radio.Group buttonStyle="solid" className='form-control-width'>
-                                                        <Radio.Button value='Y'>是</Radio.Button>
-                                                        <Radio.Button value='N'>否</Radio.Button>
+                                                    label='回答风格'
+                                                    name='param_desc'
+                                                    rules={[{ required: true, message: '回答风格不能为空' }]}>
+                                                    <Radio.Group buttonStyle="solid"
+                                                        className='form-control-width'>
+                                                        <Radio.Button onClick={() => {
+                                                            handleRedioClick('strict')
+                                                        }} value='strict'>严谨</Radio.Button>
+                                                        <Radio.Button onClick={() => {
+                                                            handleRedioClick('moderate')
+                                                        }} value='moderate'>适中</Radio.Button>
+                                                        <Radio.Button onClick={() => {
+                                                            handleRedioClick('flexib')
+                                                        }} value='flexib'>发散</Radio.Button>
+                                                        <Radio.Button value='custom'
+                                                            onClick={() => {
+                                                                setIsVisibleCus(!isVisibleCus);
+                                                                setTopPValue(0.1);
+                                                                setTempValue(0.01);
+                                                            }}
+                                                        >自定义
+                                                        </Radio.Button>
                                                     </Radio.Group>
                                                 </FormItem>
                                             </div>
-                                            <div className='flex-center'>
+                                            <div style={{
+                                                display: 'flex',
+                                                justifyContent: 'center',
+                                                alignItems: 'center'
+                                            }}>
                                                 <FormItem
-                                                    label='max token'
-                                                    name='max_token'
-                                                    rules={[{required: true, message: 'max token不能为空'}]}>
-                                                    <InputNumber
-                                                        className='questionAnswerInfo-content-title'
+                                                    label='展示引用知识'
+                                                    name='show_recall_result'
+                                                    className='form-control-width'>
+                                                    <Switch onChange={onChangeShow} />
+                                                </FormItem>
+                                            </div>
+                                            <div style={{
+                                                display: 'flex',
+                                                justifyContent: 'center',
+                                                alignItems: 'center'
+                                            }}>
+                                                <FormItem
+                                                    label='召回方式'
+                                                    name='recall_method'
+                                                    rules={[{ required: true, message: '召回方式不能为空' }]}>
+
+                                                    <Radio.Group
+                                                        style={style}
+                                                        onChange={onChangeRecallMethod}
+                                                        options={[
+                                                            { value: 'embedding', label: '向量化检索' },
+                                                            { value: 'keyword', label: '关键词检索' },
+                                                            { value: 'mixed', label: '混合检索' },
+                                                        ]}
                                                     />
                                                 </FormItem>
                                             </div>
-
-                                            {
-                                                !isVisible &&
-                                                <div className='flex-center'>
-                                                    <a onClick={() => {
-                                                        setIsVisible(!isVisible);
-                                                    }} className='link-more-settings'>
-                                                        更多设置
-                                                    </a>
-                                                </div>
-
-                                            }
-
-                                            {/* {isVisible && */}
-                                            <div style={{display: isVisible ? 'block' : 'none', paddingTop: '20px'}}>
-                                                {isVisibleCus &&
-                                                    <Space style={{width: '100%'}} direction="vertical">
-                                                        <div className='flex-center'>
-                                                            <FormItem
-                                                                label='Top-p'
-                                                                name='topP'
-                                                                className='form-control-width'
-                                                            >
-                                                                <TopPDecimalStep/>
-                                                            </FormItem>
-                                                        </div>
-                                                        <div className='flex-center'>
-                                                            <FormItem
-                                                                label='Temperature'
-                                                                name='temperature'
-                                                                className='form-control-width'
-                                                            >
-                                                                <TempDecimalStep/>
-                                                            </FormItem>
-                                                        </div>
-                                                    </Space>
-                                                }
-
-                                                <div style={{
-                                                    display: 'flex',
-                                                    justifyContent: 'center',
-                                                    alignItems: 'center'
-                                                }}>
-                                                    <FormItem
-                                                        label='回答风格'
-                                                        name='param_desc'
-                                                        rules={[{required: true, message: '回答风格不能为空'}]}>
-                                                        <Radio.Group buttonStyle="solid"
-                                                                     className='form-control-width'>
-                                                            <Radio.Button onClick={() => {
-                                                                handleRedioClick('strict')
-                                                            }} value='strict'>严谨</Radio.Button>
-                                                            <Radio.Button onClick={() => {
-                                                                handleRedioClick('moderate')
-                                                            }} value='moderate'>适中</Radio.Button>
-                                                            <Radio.Button onClick={() => {
-                                                                handleRedioClick('flexib')
-                                                            }} value='flexib'>发散</Radio.Button>
-                                                            <Radio.Button value='custom'
-                                                                          onClick={() => {
-                                                                              setIsVisibleCus(!isVisibleCus);
-                                                                              setTopPValue(0.1);
-                                                                              setTempValue(0.01);
-                                                                          }}
-                                                            >自定义
-                                                            </Radio.Button>
-                                                        </Radio.Group>
-                                                    </FormItem>
-                                                </div>
-                                                <div style={{
-                                                    display: 'flex',
-                                                    justifyContent: 'center',
-                                                    alignItems: 'center'
-                                                }}>
-                                                    <FormItem
-                                                        label='展示引用知识'
-                                                        name='show_recall_result'
-                                                        className='form-control-width'>
-                                                        <Switch onChange={onChangeShow}/>
-                                                    </FormItem>
-                                                </div>
-                                                <div style={{
-                                                    display: 'flex',
-                                                    justifyContent: 'center',
-                                                    alignItems: 'center'
-                                                }}>
-                                                    <FormItem
-                                                        label='召回方式'
-                                                        name='recall_method'
-                                                        rules={[{required: true, message: '召回方式不能为空'}]}>
-
-                                                        <Radio.Group
-                                                            style={style}
-                                                            onChange={onChangeRecallMethod}
-                                                            options={[
-                                                                {value: 'embedding', label: '向量化检索'},
-                                                                {value: 'keyword', label: '关键词检索'},
-                                                                {value: 'mixed', label: '混合检索'},
-                                                            ]}
-                                                        />
-                                                    </FormItem>
-                                                </div>
-                                                <div style={{
-                                                    display: 'flex',
-                                                    justifyContent: 'center',
-                                                    alignItems: 'center'
-                                                }}>
-                                                    <div className='section-title'>重排方式</div>
-                                                </div>
+                                            <div style={{
+                                                display: 'flex',
+                                                justifyContent: 'center',
+                                                alignItems: 'center'
+                                            }}>
+                                                <div className='section-title'>重排方式</div>
+                                            </div>
+                                            <div style={{
+                                                display: 'flex',
+                                                justifyContent: 'center',
+                                                alignItems: 'center'
+                                            }}>
+                                                <FormItem
+                                                    label='Rerank模型'
+                                                    name='rerank_status'
+                                                    valuePropName='checked'
+                                                    className='form-control-width'
+                                                >
+                                                    <Switch onChange={onChangeModel} />
+                                                </FormItem>
+                                            </div>
+                                            {isVisibleRerank &&
                                                 <div style={{
                                                     display: 'flex',
                                                     justifyContent: 'center',
                                                     alignItems: 'center'
                                                 }}>
                                                     <FormItem
-                                                        label='Rerank模型'
-                                                        name='rerank_status'
-                                                        valuePropName='checked'
-                                                        className='form-control-width'
+                                                        label='模型选择'
+                                                        name='rerank_model_name'
                                                     >
-                                                        <Switch onChange={onChangeModel}/>
-                                                    </FormItem>
-                                                </div>
-                                                {isVisibleRerank &&
-                                                    <div style={{
-                                                        display: 'flex',
-                                                        justifyContent: 'center',
-                                                        alignItems: 'center'
-                                                    }}>
-                                                        <FormItem
-                                                            label='模型选择'
-                                                            name='rerank_model_name'
-                                                        >
-                                                            <Select
-                                                                className='questionAnswerInfo-content-title'
-                                                                placeholder='请选择模型'
-                                                                // defaultValue={'rerank'}
-                                                            >
-                                                                <Option value='rerank'>默认rerank模型</Option>
-                                                            </Select>
-                                                        </FormItem>
-                                                    </div>
-                                                }
-                                                <div style={{
-                                                    display: 'flex',
-                                                    justifyContent: 'center',
-                                                    alignItems: 'center'
-                                                }}>
-                                                    <FormItem
-                                                        label='召回切片数量'
-                                                        name='slice_config_type'
-                                                        rules={[{required: true, message: '召回方式不能为空'}]}>
                                                         <Select
                                                             className='questionAnswerInfo-content-title'
-                                                            placeholder='请选择'
-                                                            onChange={onChangeCount}>
-                                                            <Option value="fixed">手动设置</Option>
-                                                            <Option value="customized">自动设置</Option>
+                                                            placeholder='请选择模型'
+                                                        // defaultValue={'rerank'}
+                                                        >
+                                                            <Option value='rerank'>默认rerank模型</Option>
                                                         </Select>
                                                     </FormItem>
                                                 </div>
+                                            }
+                                            <div style={{
+                                                display: 'flex',
+                                                justifyContent: 'center',
+                                                alignItems: 'center'
+                                            }}>
+                                                <FormItem
+                                                    label='召回切片数量'
+                                                    name='slice_config_type'
+                                                    rules={[{ required: true, message: '召回方式不能为空' }]}>
+                                                    <Select
+                                                        className='questionAnswerInfo-content-title'
+                                                        placeholder='请选择'
+                                                        onChange={onChangeCount}>
+                                                        <Option value="fixed">手动设置</Option>
+                                                        <Option value="customized">自动设置</Option>
+                                                    </Select>
+                                                </FormItem>
+                                            </div>
 
-                                                {isVisibleSlice &&
-                                                    <div style={{
-                                                        display: 'flex',
-                                                        justifyContent: 'center',
-                                                        alignItems: 'center'
-                                                    }}>
-                                                        <FormItem
-                                                            label='召回切片数'
-                                                            name='slice_count'
-                                                            rules={[{required: true, message: '切片数不能为空'}]}>
-                                                            <InputNumber max={1024} changeOnWheel
-                                                                         className='questionAnswerInfo-content-title'/>
-                                                        </FormItem>
-                                                    </div>
-                                                }
+                                            {isVisibleSlice &&
                                                 <div style={{
                                                     display: 'flex',
                                                     justifyContent: 'center',
                                                     alignItems: 'center'
                                                 }}>
                                                     <FormItem
-                                                        label='召回切片拼接方式'
-                                                        name='recall_slice_splicing_method'
-                                                    >
-                                                        <TextArea
-                                                            rows={4}
-                                                            className='form-textarea-large'
-                                                            placeholder="请输入内容"
-                                                        />
+                                                        label='召回切片数'
+                                                        name='slice_count'
+                                                        rules={[{ required: true, message: '切片数不能为空' }]}>
+                                                        <InputNumber max={1024} changeOnWheel
+                                                            className='questionAnswerInfo-content-title' />
                                                     </FormItem>
                                                 </div>
+                                            }
+                                            <div style={{
+                                                display: 'flex',
+                                                justifyContent: 'center',
+                                                alignItems: 'center'
+                                            }}>
+                                                <FormItem
+                                                    label='召回切片拼接方式'
+                                                    name='recall_slice_splicing_method'
+                                                >
+                                                    <TextArea
+                                                        rows={4}
+                                                        className='form-textarea-large'
+                                                        placeholder="请输入内容"
+                                                    />
+                                                </FormItem>
                                             </div>
-                                            {/* } */}
                                         </div>
+                                        {/* } */}
                                     </div>
+                                </div>
                             </Splitter.Panel>
                         </Splitter>
                     </div>

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 542 - 540
src/pages/deepseek/questionAnswer/list/index.tsx


+ 2 - 2
src/pages/layout/components/Header.tsx

@@ -46,7 +46,7 @@ const Header: React.FC<Props> = (props: Props) => {
                 <div className='header-logo-text'>
                     建科•小智开放平台
                 </div>
-                <Select 
+                {/* <Select 
                     className='header-platform-selector'
                     open={open}
                     value={currentMenuType}
@@ -60,7 +60,7 @@ const Header: React.FC<Props> = (props: Props) => {
                             {fruit.name}
                         </Select.Option>
                     ))}
-                </Select>
+                </Select> */}
             </div>
             <div className='header-user-section'>
                 <div className='header-operation'>

+ 89 - 87
src/pages/layout/index.tsx

@@ -12,7 +12,7 @@ import './style.less';
 
 const { Content } = Layout;
 
-const LayoutApp : React.FC = () => {
+const LayoutApp: React.FC = () => {
   const navigate = useNavigate(); // 添加useNavigate hook
   const {
     state,
@@ -30,114 +30,116 @@ const LayoutApp : React.FC = () => {
     selectedKey,
     openKeys,
   } = state;
-  
+
   const matches = useMatches();
   const location = useLocation();
-  
-  React.useEffect( () => {
-    const list = matches.filter( ( item : any ) => item.handle?.menuLevel && item.handle?.breadcrumbName ).map( ( item : any ) => {
+
+  React.useEffect(() => {
+    const list = matches.filter((item: any) => item.handle?.menuLevel && item.handle?.breadcrumbName).map((item: any) => {
       return {
         path: item.pathname,
         menuLevel: item.handle.menuLevel,
         breadcrumbName: item.handle.breadcrumbName,
       }
-    } );
-    init( list );
-  }, [ matches ] );
-  
+    });
+    init(list);
+  }, [matches]);
+
   const currentMenuType = LocalStorage.getMenuType();
-  const [ entryModalOpen, setEntryModalOpen ] = React.useState( false );
-  
-  React.useEffect( () => {
-    if ( currentMenuType === 0 ) {
-      setEntryModalOpen( true );
+  const [entryModalOpen, setEntryModalOpen] = React.useState(false);
+
+  React.useEffect(() => {
+    LocalStorage.setMenuType(0);
+
+    if (currentMenuType === 0) {
+      // setEntryModalOpen( true );
     }
     return () => reset();
-  }, [] );
-  
+  }, []);
+
   // 统一管理菜单类型状态
-  const [ menuType, setMenuType ] = React.useState( currentMenuType || ( location.pathname.startsWith( '/deepseek' ) ? 1 : 2 ) );
-  
+  const [menuType, setMenuType] = React.useState(currentMenuType || (location.pathname.startsWith('/deepseek') ? 1 : 2));
+
   // 处理菜单类型变化
-  const handleSelectChange = ( value : number ) => {
-    setMenuType( value );
+  const handleSelectChange = (value: number) => {
+    setMenuType(value);
     const defaultPath = value === 1 ? '/deepseek/questionAnswer' : '/zhipu/questionAnswer';
     // 使用navigate进行路由跳转
-    navigate( defaultPath );
+    navigate(defaultPath);
     // 同时更新selectedKey
-    onChangeSelectedKey( defaultPath, 1 );
+    onChangeSelectedKey(defaultPath, 1);
   };
-  
+
   // 添加路由变化监听
-  React.useEffect( () => {
+  React.useEffect(() => {
     const path = location.pathname;
-    const type = path.startsWith( '/deepseek' ) ? 1 : 2;
-    setMenuType( type );
-    
+    const type = path.startsWith('/deepseek') ? 1 : 2;
+    setMenuType(type);
+
     // 确保selectedKey与当前路由同步
-    if ( path !== selectedKey ) {
-      onChangeSelectedKey( path, 1 );
+    if (path !== selectedKey) {
+      onChangeSelectedKey(path, 1);
     }
-  }, [ location.pathname ] );
-  
+  }, [location.pathname]);
+
   return (
-      <Layout style={ {
-        minHeight: '100vh',
-        overflow: 'auto',
-        display: 'flex',
-        flexDirection: 'column',
-        backgroundColor: '#fff'
-      } }>
-        <Header
-            userName={ userName }
-            onClickLogout={ onClickLogout }
-            onSelectChange={ handleSelectChange } // 传递回调函数
-            currentMenuType={ menuType }
+    <Layout style={{
+      minHeight: '100vh',
+      overflow: 'auto',
+      display: 'flex',
+      flexDirection: 'column',
+      backgroundColor: '#fff'
+    }}>
+      <Header
+        userName={userName}
+        onClickLogout={onClickLogout}
+        onSelectChange={handleSelectChange} // 传递回调函数
+        currentMenuType={menuType}
+      />
+      <div style={{ display: 'flex', marginTop: '64px', backgroundColor: '#fff' }}>
+        <Nav
+          selectedKey={selectedKey}
+          onChangeSelectedKey={onChangeSelectedKey}
+          openKeys={openKeys}
+          onOpenChange={onOpenChange}
+          collapsed={collapsed}
+          onClickCollapsed={onClickCollapsed}
+          menuType={menuType}
         />
-        <div style={ { display: 'flex', marginTop: '64px', backgroundColor: '#fff' } }>
-          <Nav
-              selectedKey={ selectedKey }
-              onChangeSelectedKey={ onChangeSelectedKey }
-              openKeys={ openKeys }
-              onOpenChange={ onOpenChange }
-              collapsed={ collapsed }
-              onClickCollapsed={ onClickCollapsed }
-              menuType={ menuType }
-          />
-          <Layout style={ {
-            marginLeft: collapsed ? '80px' : '200px',
-            width: collapsed ? 'calc(100% - 80px)' : 'calc(100% - 200px)',
-            backgroundColor: '#fff',
-            minHeight: 'calc(100vh - 64px)',
-            transition: 'all 0.2s ease'
-          } }>
-            
-            <Content className='main-content'>
-              {
-                location.pathname === '/404' ?
-                    <div style={ { width: '100%', height: 20 } }></div>
-                    :
-                    <Breadcrumb routerMatchList={ routerMatchList } />
-              }
-              <div className='content-scroll-area'>
-                <Outlet />
-              </div>
-            </Content>
-          </Layout>
-        </div>
-        {
-            entryModalOpen &&
-            <EntryModal
-                open={ entryModalOpen }
-                onClickConfirm={ ( type ) => {
-                  handleSelectChange( type );
-                  setEntryModalOpen( false );
-                  LocalStorage.setMenuType( type );
-                } }
-            />
-        }
-      </Layout>
+        <Layout style={{
+          marginLeft: collapsed ? '80px' : '200px',
+          width: collapsed ? 'calc(100% - 80px)' : 'calc(100% - 200px)',
+          backgroundColor: '#fff',
+          minHeight: 'calc(100vh - 64px)',
+          transition: 'all 0.2s ease'
+        }}>
+
+          <Content className='main-content'>
+            {
+              location.pathname === '/404' ?
+                <div style={{ width: '100%', height: 20 }}></div>
+                :
+                <Breadcrumb routerMatchList={routerMatchList} />
+            }
+            <div className='content-scroll-area'>
+              <Outlet />
+            </div>
+          </Content>
+        </Layout>
+      </div>
+      {
+        entryModalOpen &&
+        <EntryModal
+          open={entryModalOpen}
+          onClickConfirm={(type) => {
+            handleSelectChange(type);
+            setEntryModalOpen(false);
+            LocalStorage.setMenuType(type);
+          }}
+        />
+      }
+    </Layout>
   );
 };
 
-export default observer( LayoutApp );
+export default observer(LayoutApp);

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott