From baa2e7c7f333be4c7c9c455d5dfc01fcd8155a7c Mon Sep 17 00:00:00 2001
From: zhengkunwang223 <1paneldev@sina.com>
Date: Thu, 5 Feb 2026 18:54:09 +0800
Subject: [PATCH] feat: change style for agent
---
.../src/views/ai/agents/agent/add/index.vue | 32 +++++++--
frontend/src/views/ai/agents/agent/index.vue | 72 +++++++++++++------
.../src/views/ai/agents/model/add/index.vue | 37 +++++++---
frontend/src/views/ai/agents/model/index.vue | 21 +++++-
4 files changed, 126 insertions(+), 36 deletions(-)
diff --git a/frontend/src/views/ai/agents/agent/add/index.vue b/frontend/src/views/ai/agents/agent/add/index.vue
index 6d71db020647..5d5d2e493db2 100644
--- a/frontend/src/views/ai/agents/agent/add/index.vue
+++ b/frontend/src/views/ai/agents/agent/add/index.vue
@@ -17,7 +17,12 @@
-
+
@@ -82,7 +87,7 @@ const open = ref(false);
const formRef = ref();
const versions = ref([]);
const accountOptions = ref([]);
-const providerOptions = ref([]);
+const providerOptions = ref>([]);
const providerModels = ref>({});
const manualModel = ref(false);
const appInfo = ref();
@@ -146,16 +151,33 @@ const loadCompose = async () => {
form.dockerCompose = res.data.dockerCompose || '';
};
+const providerLabelMap: Record = {
+ openai: 'OpenAI',
+ ollama: 'Ollama',
+ minimax: 'MiniMax',
+ qwen: 'Qwen',
+ deepseek: 'DeepSeek',
+ anthropic: 'Anthropic',
+ gemini: 'Gemini',
+};
+
+const getProviderLabel = (value: string) => {
+ return providerLabelMap[value] || value;
+};
+
const loadProviders = async () => {
const res = await getAgentProviders();
const data = res.data || [];
- providerOptions.value = data.map((item) => item.provider);
+ providerOptions.value = data.map((item) => ({
+ value: item.provider,
+ label: getProviderLabel(item.provider),
+ }));
providerModels.value = data.reduce((acc, item) => {
acc[item.provider] = item.models || [];
return acc;
}, {} as Record);
- if (!providerOptions.value.includes(form.provider) && providerOptions.value.length > 0) {
- form.provider = providerOptions.value[0];
+ if (!providerOptions.value.find((item) => item.value === form.provider) && providerOptions.value.length > 0) {
+ form.provider = providerOptions.value[0].value;
}
setDefaultModel();
};
diff --git a/frontend/src/views/ai/agents/agent/index.vue b/frontend/src/views/ai/agents/agent/index.vue
index 690f1adbff3c..01944a3bd38e 100644
--- a/frontend/src/views/ai/agents/agent/index.vue
+++ b/frontend/src/views/ai/agents/agent/index.vue
@@ -1,7 +1,13 @@
-
+
+
{{ $t('aiTools.agents.createAgent') }}
@@ -21,7 +27,11 @@
-
+
+
+ {{ getProviderLabel(row.provider) }}
+
+
@@ -42,10 +52,10 @@
/>
@@ -75,17 +85,42 @@ import ComposeLogs from '@/components/log/compose/index.vue';
import TerminalDialog from '@/views/container/container/terminal/index.vue';
import i18n from '@/lang';
import PortJumpDialog from '@/components/port-jump/index.vue';
+import DockerStatus from '@/views/container/docker-status/index.vue';
const items = ref([]);
+const loading = ref(false);
const addRef = ref();
const taskLogRef = ref();
const deleteRef = ref();
const composeLogRef = ref();
const dialogTerminalRef = ref();
const dialogPortJumpRef = ref();
+const isActive = ref(false);
+const isExist = ref(false);
const searchName = ref('');
+const providerLabelMap: Record = {
+ openai: 'OpenAI',
+ ollama: 'Ollama',
+ minimax: 'MiniMax',
+ qwen: 'Qwen',
+ deepseek: 'DeepSeek',
+ anthropic: 'Anthropic',
+ gemini: 'Gemini',
+};
+
+const getProviderLabel = (value: string) => {
+ return providerLabelMap[value] || value;
+};
const buttons = [
+ {
+ label: i18n.global.t('menu.terminal'),
+ click: (row: AI.AgentItem) => openTerminal(row),
+ },
+ {
+ label: i18n.global.t('commons.button.log'),
+ click: (row: AI.AgentItem) => openLog(row),
+ },
{
label: i18n.global.t('commons.operate.start'),
click: (row: AI.AgentItem) => onOperate(row, 'start'),
@@ -100,14 +135,6 @@ const buttons = [
label: i18n.global.t('commons.operate.restart'),
click: (row: AI.AgentItem) => onOperate(row, 'restart'),
},
- {
- label: i18n.global.t('commons.button.log'),
- click: (row: AI.AgentItem) => openLog(row),
- },
- {
- label: i18n.global.t('menu.terminal'),
- click: (row: AI.AgentItem) => openTerminal(row),
- },
{
label: i18n.global.t('commons.button.delete'),
click: (row: AI.AgentItem) => onDelete(row),
@@ -121,14 +148,19 @@ const paginationConfig = reactive({
});
const search = async () => {
- const req: SearchWithPage = {
- page: paginationConfig.currentPage,
- pageSize: paginationConfig.pageSize,
- info: searchName.value || '',
- };
- const res = await pageAgents(req);
- items.value = res.data.items || [];
- paginationConfig.total = res.data.total || 0;
+ loading.value = true;
+ try {
+ const req: SearchWithPage = {
+ page: paginationConfig.currentPage,
+ pageSize: paginationConfig.pageSize,
+ info: searchName.value || '',
+ };
+ const res = await pageAgents(req);
+ items.value = res.data.items || [];
+ paginationConfig.total = res.data.total || 0;
+ } finally {
+ loading.value = false;
+ }
};
const openCreate = () => {
diff --git a/frontend/src/views/ai/agents/model/add/index.vue b/frontend/src/views/ai/agents/model/add/index.vue
index 22035ce5679c..dae0f5717077 100644
--- a/frontend/src/views/ai/agents/model/add/index.vue
+++ b/frontend/src/views/ai/agents/model/add/index.vue
@@ -1,14 +1,19 @@
+
+
+
-
+
-
-
-
@@ -39,16 +44,28 @@ import { computed, onMounted, reactive, ref } from 'vue';
import { FormInstance } from 'element-plus';
import { Rules } from '@/global/form-rules';
import { createAgentAccount, getAgentProviders, updateAgentAccount } from '@/api/modules/ai';
-import { MsgSuccess } from '@/utils/message';
import i18n from '@/lang';
const emit = defineEmits(['search']);
const open = ref(false);
const formRef = ref();
-const providerOptions = ref([]);
+const providerOptions = ref>([]);
const providerBaseURL = ref>({});
const loading = ref(false);
+const providerLabelMap: Record = {
+ openai: 'OpenAI',
+ ollama: 'Ollama',
+ minimax: 'MiniMax',
+ qwen: 'Qwen',
+ deepseek: 'DeepSeek',
+ anthropic: 'Anthropic',
+ gemini: 'Gemini',
+};
+
+const getProviderLabel = (value: string) => {
+ return providerLabelMap[value] || value;
+};
const form = reactive({
id: 0,
@@ -95,7 +112,6 @@ const submit = async () => {
remark: form.remark,
});
}
- MsgSuccess();
emit('search');
open.value = false;
} finally {
@@ -147,13 +163,16 @@ const openDrawer = (params?: OpenParams) => {
const loadProviders = async () => {
const res = await getAgentProviders();
const data = res.data || [];
- providerOptions.value = data.map((item) => item.provider);
+ providerOptions.value = data.map((item) => ({
+ value: item.provider,
+ label: getProviderLabel(item.provider),
+ }));
providerBaseURL.value = data.reduce((acc, item) => {
acc[item.provider] = item.baseUrl || '';
return acc;
}, {} as Record);
if (!form.provider && providerOptions.value.length > 0) {
- form.provider = providerOptions.value[0];
+ form.provider = providerOptions.value[0].value;
handleProviderChange();
}
};
diff --git a/frontend/src/views/ai/agents/model/index.vue b/frontend/src/views/ai/agents/model/index.vue
index e9358a9ef121..66d13b51f7a7 100644
--- a/frontend/src/views/ai/agents/model/index.vue
+++ b/frontend/src/views/ai/agents/model/index.vue
@@ -11,8 +11,12 @@
-
-
+
+
+
+ {{ getProviderLabel(row.provider) }}
+
+
@@ -53,6 +57,19 @@ import { dateFormat } from '@/utils/util';
const items = ref([]);
const addRef = ref();
const searchName = ref('');
+const providerLabelMap: Record = {
+ openai: 'OpenAI',
+ ollama: 'Ollama',
+ minimax: 'MiniMax',
+ qwen: 'Qwen',
+ deepseek: 'DeepSeek',
+ anthropic: 'Anthropic',
+ gemini: 'Gemini',
+};
+
+const getProviderLabel = (value: string) => {
+ return providerLabelMap[value] || value;
+};
const buttons = [
{