فهرست منبع

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/modeldetailed/index.vue
liyangwenqi 5 ماه پیش
والد
کامیت
01fdaf74f5
1فایلهای تغییر یافته به همراه14 افزوده شده و 2 حذف شده
  1. 14 2
      src/views/modelMarket/components/modeldetailed.vue

+ 14 - 2
src/views/modelMarket/components/modeldetailed.vue

@@ -18,10 +18,14 @@
         <el-icon><Edit /></el-icon>
         编辑
       </el-button>
-      <el-button type="danger" size="small" class="custom-button">
+      <el-button type="danger" v-if="model.status===1" @click="handleToggle(false)" size="small" class="custom-button">
         <el-icon><SwitchButton /></el-icon>
         禁用
       </el-button>
+      <el-button type="success" v-if="model.status===0" @click="handleToggle(true)" size="small" class="custom-button">
+        <el-icon><SwitchButton /></el-icon>
+        启用
+      </el-button>
     </div>
 
     <!-- 顶部信息区(单卡片,左右分布) -->
@@ -191,12 +195,13 @@ const route = useRoute()
 const router = useRouter()
 const model = ref<ModelConfigVo>(route.query.model)
 model.value = {
+  id:0,
   modelName: "GPT-4",
   modelType:"大语言模型(LLM)",
   modelVersion:"gpt-4-1106-preview",
   baseUrl:"https://api.openai.com/v1/chat/completions",
   apiKey: "",
-  status:1,
+  status:0,
   priority:10,
   description:"GPT-4是OpenAI最先进的大型语言模型,在各种专业和学术基准上表现最佳。相比GPT-3.5,GPT-4在创造性写作、编码和解决复杂问题方面表现出显著提升,能更好地遵循用户意图,理解和生成更长的内容。",
   createTime:"2025-05-15 10:30:15",
@@ -235,6 +240,13 @@ onMounted(() => {
 })
 
 // 方法
+const handleToggle = async (value:boolean) =>{
+  const res = await toggleStatus(value, model.id);
+  if(res.code === 0){
+    model.value.status = model.value.status === 1 ? 0 : 1;
+  }
+}
+
 const handleModelAdd = () => {
   drawerVisible.value = true
 }