cc пре 5 дана
родитељ
комит
6b756844d5
1 измењених фајлова са 9 додато и 46 уклоњено
  1. 9 46
      ai-electron/frontend/src/workbench/views/agent/entry/index.vue

+ 9 - 46
ai-electron/frontend/src/workbench/views/agent/entry/index.vue

@@ -104,20 +104,6 @@
           </div>
           </div>
         </section>
         </section>
 
 
-        <section class="entry-section">
-          <h4 class="entry-section-title">可见范围</h4>
-          <div class="entry-grid">
-            <a-form-item label="可见范围" name="visibleScope" class="entry-span-all">
-              <VisibleScopeField
-                v-model:scope="form.visibleScope"
-                v-model:owner-dept-id="form.ownerDeptId"
-                :options="scopeOptions"
-                :dept-options="deptOptions"
-              />
-            </a-form-item>
-          </div>
-        </section>
-
         <section class="entry-section">
         <section class="entry-section">
           <h4 class="entry-section-title">系统提示词</h4>
           <h4 class="entry-section-title">系统提示词</h4>
           <a-form-item name="sysPrompt" class="entry-no-label">
           <a-form-item name="sysPrompt" class="entry-no-label">
@@ -183,18 +169,10 @@
     message,
     message,
   } from 'ant-design-vue';
   } from 'ant-design-vue';
   import { Icon } from '@/core/components/Icon';
   import { Icon } from '@/core/components/Icon';
-  import VisibleScopeField from '@/workbench/components/VisibleScopeField.vue';
-  import {
-    AGENT_SCOPE_OPTIONS,
-    normalizeDeptTree,
-    scopeOptionsForUser,
-  } from '@/workbench/constants/visibleScope';
-  import { getAgentScopeOptions, getEntryAgent, updateEntryAgent } from '@/workbench/api/agent';
+  import { getEntryAgent, updateEntryAgent } from '@/workbench/api/agent';
   import { optionModelConfig } from '@/workbench/api/model';
   import { optionModelConfig } from '@/workbench/api/model';
 
 
   const modelOptions = ref<any[]>([]);
   const modelOptions = ref<any[]>([]);
-  const deptOptions = ref<any[]>([]);
-  const canPublic = ref(false);
   const buttonLoading = ref(false);
   const buttonLoading = ref(false);
   const loaded = ref(false);
   const loaded = ref(false);
   const loading = ref(true);
   const loading = ref(true);
@@ -214,14 +192,9 @@
     maxIters: 10,
     maxIters: 10,
     status: '0',
     status: '0',
     remark: undefined as string | undefined,
     remark: undefined as string | undefined,
-    ownerDeptId: undefined as string | number | undefined,
-    visibleScope: undefined as string | undefined,
   };
   };
 
 
   const form = ref<any>({ ...initFormData });
   const form = ref<any>({ ...initFormData });
-  const scopeOptions = computed(() =>
-    scopeOptionsForUser(AGENT_SCOPE_OPTIONS, canPublic.value, form.value.visibleScope),
-  );
 
 
   const rules: any = computed(() => ({
   const rules: any = computed(() => ({
     agentName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
     agentName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
@@ -230,21 +203,11 @@
   }));
   }));
 
 
   const loadOptions = async () => {
   const loadOptions = async () => {
-    const [modelRes, scopeRes] = await Promise.allSettled([
-      optionModelConfig('chat'),
-      getAgentScopeOptions(),
-    ]);
-    if (modelRes.status === 'fulfilled') {
-      modelOptions.value = modelRes.value ?? [];
-    } else {
+    try {
+      modelOptions.value = (await optionModelConfig('chat')) ?? [];
+    } catch {
       message.warning('模型 选项加载失败,对应下拉暂不可用');
       message.warning('模型 选项加载失败,对应下拉暂不可用');
     }
     }
-    if (scopeRes.status === 'fulfilled') {
-      deptOptions.value = normalizeDeptTree(scopeRes.value?.depts ?? []);
-      canPublic.value = !!scopeRes.value?.superAdmin;
-    } else {
-      message.warning('部门 选项加载失败,归属部门暂不可选');
-    }
   };
   };
 
 
   const loadEntry = async () => {
   const loadEntry = async () => {
@@ -258,8 +221,9 @@
       form.value = {
       form.value = {
         ...initFormData,
         ...initFormData,
         ...data,
         ...data,
-        visibleScope: data.visibleScope ?? (canPublic.value ? '0' : '2'),
-        ownerDeptId: data.ownerDeptId ?? undefined,
+        // 入口智能体固定全员可见,不提供可见范围配置;保存时随 payload 落库
+        visibleScope: '0',
+        ownerDeptId: null,
         dailyTokenQuota: data.dailyTokenQuota ?? 0,
         dailyTokenQuota: data.dailyTokenQuota ?? 0,
         dailyRequestQuota: data.dailyRequestQuota ?? 0,
         dailyRequestQuota: data.dailyRequestQuota ?? 0,
         monthlyTokenQuota: data.monthlyTokenQuota ?? 0,
         monthlyTokenQuota: data.monthlyTokenQuota ?? 0,
@@ -288,9 +252,8 @@
     }
     }
   };
   };
 
 
-  onMounted(async () => {
-    // 先加载可见范围选项,确保 loadEntry 能按当前用户身份选择默认值
-    await loadOptions();
+  onMounted(() => {
+    loadOptions();
     loadEntry();
     loadEntry();
   });
   });
 </script>
 </script>