重构:移除 AI 管理模块

This commit is contained in:
焦龙言
2026-07-24 19:06:55 +08:00
parent a509dada79
commit 5209911dd8
32 changed files with 96 additions and 4084 deletions
@@ -1,53 +0,0 @@
import request from "@/utils/request";
// 获取会话列表
export function listChatSession() {
return request({
url: "/ai/chat/session/list",
method: "get",
});
}
// 删除会话
export function delChatSession(sessionId) {
return request({
url: "/ai/chat/session/" + sessionId,
method: "delete",
});
}
// 获取会话详情
export function getChatSession(sessionId) {
return request({
url: "/ai/chat/session/" + sessionId,
method: "get",
});
}
// 获取用户对话配置
export function getUserChatConfig() {
return request({
url: "/ai/chat/config",
method: "get",
});
}
// 保存用户对话配置
export function saveUserChatConfig(data) {
return request({
url: "/ai/chat/config",
method: "put",
data: data,
});
}
// 取消对话
export function cancelChatRun(runId) {
return request({
url: "/ai/chat/cancel",
method: "post",
data: {
runId: runId,
},
});
}
@@ -1,52 +0,0 @@
import request from "@/utils/request";
// 查询AI模型列表
export function listModel(query) {
return request({
url: "/ai/model/list",
method: "get",
params: query,
});
}
// 查询所有AI模型列表
export function listModelAll() {
return request({
url: "/ai/model/all",
method: "get",
});
}
// 查询AI模型详细
export function getModel(modelId) {
return request({
url: "/ai/model/" + modelId,
method: "get",
});
}
// 新增AI模型
export function addModel(data) {
return request({
url: "/ai/model",
method: "post",
data: data,
});
}
// 修改AI模型
export function updateModel(data) {
return request({
url: "/ai/model",
method: "put",
data: data,
});
}
// 删除AI模型
export function delModel(modelId) {
return request({
url: "/ai/model/" + modelId,
method: "delete",
});
}
@@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1768874965762" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9150" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100"><path d="M568.32 183.978667q4.266667 0 8.362667-0.796445t7.964444-2.446222q3.925333-1.592889 7.395556-3.925333 3.527111-2.332444 6.485333-5.290667 2.958222-3.015111 5.290667-6.485333 2.332444-3.470222 3.982222-7.395556 1.592889-3.868444 2.389333-7.964444 0.853333-4.152889 0.853334-8.362667 0-4.152889-0.853334-8.305778-0.796444-4.096-2.389333-7.964444-1.649778-3.925333-3.982222-7.395556-2.275556-3.527111-5.290667-6.485333-2.958222-2.958222-6.485333-5.290667-3.470222-2.332444-7.395556-3.982222-3.868444-1.592889-7.964444-2.389333-4.096-0.853333-8.305778-0.853334H301.169778q-111.786667 0-190.862222 79.075556T31.288889 368.64v291.157333q0 111.843556 79.075555 190.919111t190.862223 79.075556h598.414222q28.672 0 48.981333-20.309333t20.309334-49.038223V489.244444q0-4.209778-0.853334-8.305777-0.796444-4.152889-2.389333-8.021334-1.649778-3.868444-3.982222-7.395555-2.275556-3.470222-5.290667-6.428445-2.958222-3.015111-6.485333-5.347555-3.413333-2.275556-7.395556-3.982222-3.811556-1.536-7.964444-2.389334-4.096-0.796444-8.305778-0.796444t-8.362667 0.796444q-4.096 0.853333-7.964444 2.446222-3.868444 1.592889-7.395556 3.982223-3.470222 2.275556-6.485333 5.290666-2.958222 2.958222-5.290667 6.428445-2.275556 3.527111-3.982222 7.395555-1.536 3.868444-2.389333 7.964445-0.796444 4.152889-0.796445 8.362666v355.157334H301.226667q-76.458667 0-130.56-54.044445-54.044444-54.044444-54.044445-130.56V368.64q0-76.515556 54.044445-130.56 54.101333-54.044444 130.56-54.044444h267.150222z" p-id="9151"></path><path d="M300.999111 398.222222m51.2 0l0 0q51.2 0 51.2 51.2l0 125.155556q0 51.2-51.2 51.2l0 0q-51.2 0-51.2-51.2l0-125.155556q0-51.2 51.2-51.2Z" p-id="9152"></path><path d="M585.443556 398.222222m51.2 0l0 0q51.2 0 51.2 51.2l0 125.155556q0 51.2-51.2 51.2l0 0q-51.2 0-51.2-51.2l0-125.155556q0-51.2 51.2-51.2Z" p-id="9153"></path><path d="M682.723556 200.704c-16.156444 3.982222-16.156444 26.965333 0 30.947556l66.503111 16.384a91.022222 91.022222 0 0 1 66.56 66.56l16.384 66.503111c3.982222 16.156444 26.965333 16.156444 30.947555 0l16.384-66.503111a91.022222 91.022222 0 0 1 66.56-66.56l66.503111-16.384c16.156444-3.982222 16.156444-26.965333 0-30.947556l-66.503111-16.440889a91.022222 91.022222 0 0 1-66.56-66.56L863.118222 51.313778c-3.982222-16.156444-26.965333-16.156444-30.947555 0L815.786667 117.76a91.022222 91.022222 0 0 1-66.56 66.56L682.666667 200.647111z" p-id="9154"></path></svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

@@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1768875270205" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12326" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100"><path d="M950.857143 515.657143a163.693714 163.693714 0 0 0-62.390857-128 163.876571 163.876571 0 0 0-102.180572-292.571429h-548.571428a163.876571 163.876571 0 0 0-102.180572 292.571429 162.486857 162.486857 0 0 0 0 256 163.876571 163.876571 0 0 0 102.180572 292.571428h548.571428a163.876571 163.876571 0 0 0 102.180572-292.571428A163.693714 163.693714 0 0 0 950.857143 515.657143z m-804.571429-256a91.428571 91.428571 0 0 1 91.428572-91.428572H256v36.571429a36.571429 36.571429 0 0 0 73.142857 0v-36.571429h73.142857v36.571429a36.571429 36.571429 0 0 0 73.142857 0v-36.571429h310.857143a91.428571 91.428571 0 1 1 0 182.857143h-548.571428A91.428571 91.428571 0 0 1 146.285714 259.657143z m731.428572 512a91.428571 91.428571 0 0 1-91.428572 91.428571h-548.571428a91.428571 91.428571 0 0 1 0-182.857143H256v36.571429a36.571429 36.571429 0 0 0 73.142857 0v-36.571429h73.142857v36.571429a36.571429 36.571429 0 0 0 73.142857 0v-36.571429h310.857143a91.428571 91.428571 0 0 1 91.428572 91.428572zM237.714286 607.085714a91.428571 91.428571 0 0 1 0-182.857143H256v36.571429a36.571429 36.571429 0 0 0 73.142857 0v-36.571429h73.142857v36.571429a36.571429 36.571429 0 0 0 73.142857 0v-36.571429h310.857143a91.428571 91.428571 0 1 1 0 182.857143h-548.571428z" p-id="12327"></path></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

@@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1768874837359" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4895" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100"><path d="M418.133333 356.266667L298.666667 661.333333h66.133333l25.6-70.4H512l25.6 70.4h66.133333l-121.6-305.066666h-64z m-10.666666 183.466666L448 426.666667l42.666667 113.066666h-83.2zM635.733333 356.266667h61.866667V661.333333h-61.866667z" p-id="4896"></path><path d="M512 85.333333L142.933333 298.666667v426.666666L512 938.666667l369.066667-213.333334V298.666667L512 85.333333z m292.266667 595.2L512 849.066667l-292.266667-168.533334V343.466667L512 174.933333l292.266667 168.533334v337.066666z" p-id="4897"></path></svg>

Before

Width:  |  Height:  |  Size: 848 B

@@ -1,170 +0,0 @@
<template>
<div class="ai-message-container">
<div v-if="reasoningContent" class="reasoning-section">
<div class="reasoning-header" @click="toggleReasoning">
<el-icon :class="{ 'is-expanded': isReasoningExpanded }"
><ArrowRight
/></el-icon>
<span>深度思考过程</span>
<span class="reasoning-status" v-if="!isThinkingComplete"
>思考中...</span
>
</div>
<div v-show="isReasoningExpanded" class="reasoning-content">
<MarkdownRender :content="reasoningContent" :is-dark="isDark" />
</div>
</div>
<div class="ai-message-content">
<MarkdownRender :content="content" :is-dark="isDark" />
</div>
<div
v-if="loading && !content && !reasoningContent"
class="typing-indicator"
>
<span></span>
<span></span>
<span></span>
</div>
</div>
</template>
<script setup>
import { computed, ref } from "vue";
import { MarkdownRender } from "markstream-vue";
import { useDark } from "@vueuse/core";
import { enableKatex, enableMermaid } from "markstream-vue";
import "markstream-vue/index.css";
import "katex/dist/katex.min.css";
enableMermaid();
enableKatex();
const isDark = useDark();
const props = defineProps({
content: {
type: String,
default: "",
},
reasoningContent: {
type: String,
default: "",
},
loading: {
type: Boolean,
default: false,
},
});
const isReasoningExpanded = ref(true);
const isThinkingComplete = computed(() => {
return !!props.content;
});
function toggleReasoning() {
isReasoningExpanded.value = !isReasoningExpanded.value;
}
</script>
<style lang="scss">
.ai-message-container {
width: 100%;
.ai-message-content {
font-size: 14px;
line-height: 1.6;
color: var(--el-text-color-primary);
overflow-wrap: break-word;
word-break: break-word;
}
}
.reasoning-section {
margin-bottom: 15px;
border-left: 2px solid var(--el-border-color);
padding-left: 10px;
.reasoning-header {
display: flex;
align-items: center;
cursor: pointer;
color: var(--el-text-color-secondary);
font-size: 13px;
user-select: none;
margin-bottom: 5px;
.el-icon {
margin-right: 4px;
transition: transform 0.3s;
&.is-expanded {
transform: rotate(90deg);
}
}
.reasoning-status {
margin-left: 10px;
font-size: 12px;
color: #e6a23c;
animation: blink 1.5s infinite;
}
}
.reasoning-content {
font-size: 13px;
color: var(--el-text-color-regular);
padding: 8px;
background-color: var(--el-fill-color-light);
border-radius: 4px;
overflow-wrap: break-word;
word-break: break-word;
}
}
@keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
.typing-indicator {
display: flex;
align-items: center;
padding: 8px 0;
span {
display: inline-block;
width: 6px;
height: 6px;
background-color: var(--el-text-color-secondary);
border-radius: 50%;
animation: typing 1.4s infinite ease-in-out both;
margin-right: 4px;
&:nth-child(1) {
animation-delay: -0.32s;
}
&:nth-child(2) {
animation-delay: -0.16s;
}
}
}
@keyframes typing {
0%,
80%,
100% {
transform: scale(0);
}
40% {
transform: scale(1);
}
}
</style>
File diff suppressed because it is too large Load Diff
@@ -1,473 +0,0 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryRef"
:inline="true"
v-show="showSearch"
>
<el-form-item label="模型编码" prop="modelCode">
<el-input
v-model="queryParams.modelCode"
placeholder="请输入模型编码"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="提供商" prop="provider">
<el-select
v-model="queryParams.provider"
placeholder="请选择提供商"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
>
<el-option
v-for="dict in ai_provider_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="模型状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"
>搜索</el-button
>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['ai:model:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['ai:model:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['ai:model:remove']"
>删除</el-button
>
</el-col>
<right-toolbar
v-model:showSearch="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="modelList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="模型ID" align="center" prop="modelId" />
<el-table-column label="模型编码" align="center" prop="modelCode" />
<el-table-column label="提供商" align="center" prop="provider">
<template #default="scope">
<dict-tag :options="ai_provider_type" :value="scope.row.provider" />
</template>
</el-table-column>
<el-table-column label="支持推理" align="center" prop="supportReasoning">
<template #default="scope">
<dict-tag :options="sys_yes_no" :value="scope.row.supportReasoning" />
</template>
</el-table-column>
<el-table-column label="支持图片" align="center" prop="supportImages">
<template #default="scope">
<dict-tag :options="sys_yes_no" :value="scope.row.supportImages" />
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
>
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
width="180"
align="center"
class-name="small-padding fixed-width"
>
<template #default="scope">
<el-button
link
type="primary"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ai:model:edit']"
>修改</el-button
>
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ai:model:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" v-model="open" width="700px" append-to-body>
<el-form ref="modelRef" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="模型编码" prop="modelCode">
<el-input
v-model="form.modelCode"
placeholder="请输入模型编码 (如 deepseek-r1)"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="模型名称" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入模型名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="提供商" prop="provider">
<el-select
v-model="form.provider"
placeholder="请选择提供商"
style="width: 100%"
>
<el-option
v-for="dict in ai_provider_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="模型排序" prop="modelSort">
<el-input-number
v-model="form.modelSort"
:min="0"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="API Key" prop="apiKey">
<el-input
v-model="form.apiKey"
placeholder="请输入API Key"
type="password"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="Base URL" prop="baseUrl">
<el-input v-model="form.baseUrl" placeholder="请输入Base URL" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="最大输出" prop="maxTokens">
<el-input-number
v-model="form.maxTokens"
:min="0"
style="width: 100%"
placeholder="最大输出"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认温度" prop="temperature">
<el-input-number
v-model="form.temperature"
:min="0"
:max="2"
:step="0.1"
placeholder="默认温度"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="支持推理" prop="supportReasoning">
<el-radio-group v-model="form.supportReasoning">
<el-radio
v-for="dict in sys_yes_no"
:key="dict.value"
:value="dict.value"
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="支持图片" prop="supportImages">
<el-radio-group v-model="form.supportImages">
<el-radio
v-for="dict in sys_yes_no"
:key="dict.value"
:value="dict.value"
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="模型类型" prop="modelType">
<el-input
v-model="form.modelType"
placeholder="请输入模型类型 (可选)"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in sys_normal_disable"
:key="dict.value"
:value="dict.value"
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="AiModel">
import {
listModel,
addModel,
delModel,
getModel,
updateModel,
} from "@/api/ai/model";
const { proxy } = getCurrentInstance();
const { ai_provider_type, sys_normal_disable, sys_yes_no } = proxy.useDict(
"ai_provider_type",
"sys_normal_disable",
"sys_yes_no",
);
const modelList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
modelCode: undefined,
provider: undefined,
status: undefined,
},
rules: {
modelCode: [
{ required: true, message: "模型编码不能为空", trigger: "blur" },
],
provider: [
{ required: true, message: "提供商不能为空", trigger: "change" },
],
modelSort: [
{ required: true, message: "模型排序不能为空", trigger: "blur" },
],
},
});
const { queryParams, form, rules } = toRefs(data);
/** 查询列表 */
function getList() {
loading.value = true;
listModel(queryParams.value).then((response) => {
modelList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
modelId: undefined,
modelCode: undefined,
modelName: undefined,
provider: undefined,
modelSort: 0,
apiKey: undefined,
baseUrl: undefined,
maxTokens: undefined,
temperature: undefined,
supportReasoning: "N",
supportImages: "N",
modelType: undefined,
status: "0",
remark: undefined,
};
proxy.resetForm("modelRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map((item) => item.modelId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加模型";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const modelId = row.modelId || ids.value;
getModel(modelId).then((response) => {
form.value = response.data;
open.value = true;
title.value = "修改模型";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["modelRef"].validate((valid) => {
if (valid) {
if (form.value.modelId != undefined) {
updateModel(form.value).then((response) => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addModel(form.value).then((response) => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const modelIds = row.modelId || ids.value;
proxy.$modal
.confirm('是否确认删除模型编号为"' + modelIds + '"的数据项?')
.then(function () {
return delModel(modelIds);
})
.then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}
getList();
</script>
@@ -1,42 +1,14 @@
import vue from '@vitejs/plugin-vue'
import monacoEditorEsmPlugin from 'vite-plugin-monaco-editor-esm'
import createAutoImport from './auto-import'
import createSvgIcon from './svg-icon'
import createCompression from './compression'
import createSetupExtend from './setup-extend'
const monacoWorkers = [
{
label: 'editorWorkerService',
entry: 'monaco-editor/esm/vs/editor/editor.worker.js'
},
{
label: 'css',
entry: 'monaco-editor/esm/vs/language/css/css.worker.js'
},
{
label: 'html',
entry: 'monaco-editor/esm/vs/language/html/html.worker.js'
},
{
label: 'json',
entry: 'monaco-editor/esm/vs/language/json/json.worker.js'
},
{
label: 'typescript',
entry: 'monaco-editor/esm/vs/language/typescript/ts.worker.js'
}
]
export default function createVitePlugins(viteEnv, isBuild = false) {
const vitePlugins = [vue()]
vitePlugins.push(createAutoImport())
vitePlugins.push(createSetupExtend())
vitePlugins.push(monacoEditorEsmPlugin({
languageWorkers: [],
customWorkers: monacoWorkers
}))
vitePlugins.push(createSvgIcon(isBuild))
isBuild && vitePlugins.push(...createCompression(viteEnv))
return vitePlugins