Explorar o código

VIP权限和是否公开进行关联

sunsheng hai 2 meses
pai
achega
17ddff93d6

+ 2 - 2
env/.env.development

@@ -2,8 +2,8 @@
 VITE_ENV = 'development'
 
 # Api地址
-# VITE_API_URL = 'http://192.168.3.123:8091'
-VITE_API_URL = 'http://xia0miduo.gicp.net:8091'
+VITE_API_URL = 'http://192.168.3.123:8090'
+# VITE_API_URL = 'http://xia0miduo.gicp.net:8091'
 
 #跳转地址
 VITE_JUMP_URL = 'http://localhost:4000/#/knowledgeChat?showMenu=true&chatMode=LOCAL'

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

@@ -134,6 +134,11 @@ const SliceDetail: React.FC = () => {
                             rules={[{ required: true, message: '内容不能为空' }]}
                         >
                             <MdEditor
+                                config={{
+                                    view:{
+                                        menu:false
+                                    }
+                                }}
                                 value={contentMd}
                                 style={{ height: "450px",width:'98%' }}
                                 renderHTML={customRender}

+ 22 - 6
src/pages/deepseek/questionAnswer/info/index.tsx

@@ -136,6 +136,7 @@ const QuestionAnswerInfo: React.FC = () => {
     const [name, setName] = React.useState('');
     const [appTypeList, setAppTypeList] = React.useState<AppTypeList>([]);
     const [appVisibleList, setAppVisibleList] = React.useState<AppTypeList>([]); // 是否公开
+    const [visibleFlag, setVisibleFlag] = React.useState<string|number>(0); // 是否公开用来判断是否展示VIP用户
     const [updateFlag, setUpdateFlag] = React.useState<boolean>();
     const [createFlag, setCreateFlag] = React.useState<boolean>();
     const [appProjectList, setAppProjectList] = React.useState<AppTypeList>([]);
@@ -299,7 +300,6 @@ const QuestionAnswerInfo: React.FC = () => {
                     setIsDeepThinkVisible(false);
                 }
 
-                console.log(info.knowledgeIds, 'info.knowledgeIds')
                 form.setFieldsValue({
                     id: info.id,
                     name: info.name,  //应用名称
@@ -315,7 +315,7 @@ const QuestionAnswerInfo: React.FC = () => {
                     questionList: sd, //问题列表
                     max_token: info.maxToken, //应用最大token
                     updateDate: info.updateDate, // 更新时间
-                    appProId: info.appProId,// 项目
+                    appProId: info.appProId.join('-'),// 项目
                     typeId: info.typeId, //应用类型
                     visible: info.visible || '0', //是否公开
                     param_desc: data_info.param_desc, //回答风格
@@ -331,6 +331,7 @@ const QuestionAnswerInfo: React.FC = () => {
                     //recall_index_type_list: info.recall_index_type_list, //知识库id
                     //rerank_index_type_list: info.rerank_index_type_list, //知识库id
                 })
+                setVisibleFlag(info.visible || '0')
                 if(info.vipList&&info.vipList.length>0){
                     setVipList(info.vipList);
                 }
@@ -391,6 +392,7 @@ const QuestionAnswerInfo: React.FC = () => {
                     form.setFieldsValue({
                         visible: list[0]?.value
                     });
+                    setVisibleFlag(list[0]?.value);
                 }
             } catch (error: any) {
                 console.error(error);
@@ -432,7 +434,18 @@ const QuestionAnswerInfo: React.FC = () => {
         fetchAppProType: async () => {
             try {
                 const res = await apis.fetchTakaiAppTypeList('projectTree');
-                const list: AppTypeList = res.data;
+                console.log('res.data',res.data)
+                const list: AppTypeList = res.data?.reduce((acc:any,item: any) => {
+                    if(item.children.length>0){
+                        item.children.forEach((val:any)=>{
+                            acc.push({
+                                label: val.label,
+                                value: `${item.value}-${val.value}`,
+                            })
+                        })
+                    }
+                    return acc;
+                },[]);
                 setAppProjectList(list);
             } catch (error: any) {
                 console.error(error);
@@ -532,7 +545,7 @@ const QuestionAnswerInfo: React.FC = () => {
                 typeId: values.typeId, // 应用类型
                 visible: values.visible, // 是否公开
                 vipList: vipList, // vip用户列表
-                appProId: values.appProId,// 项目
+                appProId: values.appProId[0].split('-'),// 项目
                 userId: userId, // 用户id
             };
             console.log(info, 'info data');
@@ -764,6 +777,9 @@ const QuestionAnswerInfo: React.FC = () => {
                                     className='questionAnswerInfo-content-title'
                                     placeholder='请选择是否公开'
                                     allowClear={true}
+                                    onChange={(e) => {
+                                        setVisibleFlag(e)
+                                    }}
                                 >
                                     {
                                         appVisibleList.map((item, index) => {
@@ -775,7 +791,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                 </Select>
                             </FormItem>
                             {/* VIP用户 */}
-                            <FormItem
+                            {visibleFlag==1&&<FormItem
                                 label='VIP用户'
                             >
                                 <div className='tags-info'>
@@ -801,7 +817,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                         }} type="primary" variant="outlined" onClick={() => { setIsModalOpen(true) }}>选择</Button>
                                     </p>
                                 </div>
-                            </FormItem>
+                            </FormItem>}
                             <FormItem
                                 label='问答应用描述'
                                 name='desc'