修改问题

This commit is contained in:
zpc 2024-08-06 03:32:07 +08:00
parent 27c325edc0
commit f10e70b9d0
12 changed files with 216 additions and 126 deletions

View File

@ -7,7 +7,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>寰梦后台管理</title> <title>寰梦后台管理</title>
<script type="module" crossorigin src="/static/js/index-BAKS-SaU.js"></script> <script type="module" crossorigin src="/static/js/index-BDfjS8Pq.js"></script>
<link rel="stylesheet" crossorigin href="/static/css/index-CzwB8sLn.css"> <link rel="stylesheet" crossorigin href="/static/css/index-CzwB8sLn.css">
</head> </head>

View File

@ -76,7 +76,7 @@ function updateValueNumber(event: number) {
} }
async function fileupload() { async function fileupload() {
const response = await Tools.imageFileUpload(0, 1); const response = await Tools.imageFileUpload(0, 0);
console.log(response); console.log(response);
updateValueNumber(response.imageId); updateValueNumber(response.imageId);

View File

@ -69,17 +69,24 @@ function jumpPro() {
</div> </div>
<div style="flex: 1 1 0%" v-else></div> <div style="flex: 1 1 0%" v-else></div>
<!-- Pro --> <!-- Pro -->
<div class="hzy-header-btn text-danger" @click="jumpPro()" style="font-weight: bold" <!-- <div class="hzy-header-btn text-danger" @click="jumpPro()" style="font-weight: bold"
v-if="!coreStore.state.isMobile">Pro By React v-if="!coreStore.state.isMobile">Pro By React
</div> </div> -->
<!-- HzyAdmin 文档 --> <!-- HzyAdmin 文档 -->
<a-tooltip> <!-- <a-tooltip>
<template #title>HzyAdmin 文档</template> <template #title>HzyAdmin 文档</template>
<div class="hzy-header-btn" @click="jumpDoc" v-if="!coreStore.state.isMobile"> <div class="hzy-header-btn" @click="jumpDoc" v-if="!coreStore.state.isMobile">
<a-badge status="success" dot> <a-badge status="success" dot>
<AppIcon name="rocket-outlined" :size="iconSize"/> <AppIcon name="rocket-outlined" :size="iconSize"/>
</a-badge> </a-badge>
</div> </div>
</a-tooltip> -->
<a-tooltip>
<template #title>清除缓存</template>
<div class="hzy-header-btn" @click="onReload">
<AppIcon name="ClearOutlined" :size="iconSize"/>
</div>
</a-tooltip> </a-tooltip>
<!-- 刷新当前选项卡 --> <!-- 刷新当前选项卡 -->

View File

@ -22,7 +22,7 @@ const state = reactive({
state: false, state: false,
vm: { vm: {
name: undefined, name: undefined,
imageType: undefined, imageType: '-1',
}, },
sort: [] as any[], sort: [] as any[],
}, },
@ -135,7 +135,7 @@ async function findList() {
state.loading = false; state.loading = false;
if (result.code != 200) return; if (result.code != 200) return;
state.page = result.data.page; state.page = result.data.page;
state.size = 50;//result.data.size; state.size = result.data.size;
state.total = result.data.total; state.total = result.data.total;
state.columns = columns,//result.data.columns; state.columns = columns,//result.data.columns;
state.data = result.data.dataSource; state.data = result.data.dataSource;
@ -193,15 +193,19 @@ async function imageUpdate(image: any) {
<TableCurd ref="refTableCurd" :config="state" @change="(changeTable) => { <TableCurd ref="refTableCurd" :config="state" @change="(changeTable) => {
state.page = changeTable.pagination.current ?? 1; state.page = changeTable.pagination.current ?? 1;
state.size = changeTable.pagination.pageSize ?? state.size; state.size = changeTable.pagination.pageSize ?? state.size;
console.log(changeTable);
state.search.sort = changeTable.sorter instanceof Array ? [...changeTable.sorter] : [changeTable.sorter]; state.search.sort = changeTable.sorter instanceof Array ? [...changeTable.sorter] : [changeTable.sorter];
findList(); findList();
} }
" @show-size-change="({ current, size }) => { "
@show-size-change="({ current, size }) => {
state.page = current == 0 ? 1 : current; state.page = current == 0 ? 1 : current;
console.log(size,state);
state.size = size; state.size = size;
findList(); findList();
} }
"> "
>
<!-- search --> <!-- search -->
<template #search> <template #search>
<a-form ref="refSearchForm" :model="state.search.vm" v-if="power.search"> <a-form ref="refSearchForm" :model="state.search.vm" v-if="power.search">

View File

@ -140,11 +140,6 @@ function exportExcel() {
<hm-tenant-select v-model:value="state.search.vm.tenantId" :ShowAll="true" /> <hm-tenant-select v-model:value="state.search.vm.tenantId" :ShowAll="true" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<a-form-item class="mb-0" name="ModelName" label="模型名称">
<a-input v-model:value="state.search.vm.modelName" placeholder="模型名称" />
</a-form-item>
</a-col>
<!--button--> <!--button-->
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="text-right"> <a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="text-right">
<a-space :size="8"> <a-space :size="8">
@ -216,8 +211,21 @@ function exportExcel() {
</template> </template>
<!-- table-col --> <!-- table-col -->
<template #table-col> <template #table-col>
<template v-for="item,index in state.columns.filter((w:any) => w.fieldName !== 'id' && w.show)" :key="item.fieldName"> <template v-for="item,index in state.columns.filter((w:any) => w.show)" :key="item.fieldName">
<a-table-column :title="item.title" :data-index="item.fieldName" :sorter="item.sort ? { multiple: index + 1 } : false" /> <a-table-column v-if="item.fieldName!='systemTemplate'" :title="item.title" :data-index="item.fieldName" :sorter="item.sort ? { multiple: index + 1 } : false" />
<a-table-column v-else
title="模型上下文模板"
data-index="systemTemplate"
min-width="300px"
width="500px"
:resizable="true"
>
<template #default="{ record }">
<div style="width: 100%; min-height: 150px;max-height: 300px; overflow: auto">
{{ record.systemTemplate }}
</div>
</template>
</a-table-column>
</template> </template>
<!-- 操作 --> <!-- 操作 -->
<a-table-column title="操作" data-index="id" v-if="power.update || power.delete" width="200px" fixed="right"> <a-table-column title="操作" data-index="id" v-if="power.update || power.delete" width="200px" fixed="right">

View File

@ -1,112 +1,177 @@
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import { FormInstance } from "ant-design-vue"; import { FormInstance } from "ant-design-vue";
import Tools from "@/core/utils/Tools"; import Tools from "@/core/utils/Tools";
import T_Model_ConfigService from "@/services/apps/T_Model_Configs/T_Model_ConfigService"; import T_Model_ConfigService from "@/services/apps/T_Model_Configs/T_Model_ConfigService";
// //
const props = defineProps<{ onSuccess: () => void }>(); const props = defineProps<{ onSuccess: () => void }>();
const state = reactive({ const state = reactive({
vm: { vm: {
id: "", id: "",
form: {} as any, form: {} as any,
}, },
visible: false, visible: false,
loading: false, loading: false,
}); });
// //
const refForm = ref<FormInstance>(); const refForm = ref<FormInstance>();
// //
defineExpose({ defineExpose({
/** /**
* 打开表单初始化 * 打开表单初始化
* @param key * @param key
*/ */
open: (key: string = "") => { open: (key: string = "") => {
state.visible = true; state.visible = true;
if (state.visible) { if (state.visible) {
state.vm.id = key; state.vm.id = key;
}
refForm.value?.resetFields();
//
state.loading = true;
T_Model_ConfigService.findForm(key).then((res) => {
state.loading = false;
if (res.code != 200) return;
state.vm = res.data;
});
},
});
/**
*保存数据
*/
function save() {
refForm.value?.validate().then(async () => {
try {
state.loading = true;
const result = await T_Model_ConfigService.saveForm(state.vm.id, state.vm.form);
state.loading = false;
if (result.code != 200) return;
Tools.message.success("操作成功!");
props.onSuccess();
state.visible = false;
} catch (error) {
state.loading = false;
}
});
} }
refForm.value?.resetFields();
//
state.loading = true;
T_Model_ConfigService.findForm(key).then((res) => {
state.loading = false;
if (res.code != 200) return;
state.vm = res.data;
});
},
});
/**
*保存数据
*/
function save() {
refForm.value?.validate().then(async () => {
try {
state.loading = true;
const result = await T_Model_ConfigService.saveForm(
state.vm.id,
state.vm.form
);
state.loading = false;
if (result.code != 200) return;
Tools.message.success("操作成功!");
props.onSuccess();
state.visible = false;
} catch (error) {
state.loading = false;
}
});
}
</script> </script>
<template> <template>
<a-modal v-model:open="state.visible" :title="state.vm.id ? '编辑' : '新建'" centered @ok="state.visible = false" :width="800"> <a-modal
<template #footer> v-model:open="state.visible"
<a-button type="primary" :loading="state.loading" @click="save()"> 提交</a-button> :title="state.vm.id ? '编辑' : '新建'"
<a-button @click="state.visible = false">关闭</a-button> centered
@ok="state.visible = false"
:width="1200"
>
<template #footer>
<a-button type="primary" :loading="state.loading" @click="save()">
提交</a-button
>
<a-button @click="state.visible = false">关闭</a-button>
</template> </template>
<a-spin :spinning="state.loading"> <a-spin :spinning="state.loading">
<a-form ref="refForm" layout="vertical" :model="state.vm.form"> <a-form ref="refForm" layout="vertical" :model="state.vm.form">
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="项目" name="tenantId"> <a-form-item label="项目" name="tenantId">
<hm-tenant-select v-model:value="state.vm.form.tenantId" /> <hm-tenant-select v-model:value="state.vm.form.tenantId" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="模型名称" name="modelName" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"> <a-form-item
<a-input v-model:value="state.vm.form.modelName" placeholder="请输入" /> label="模型名称"
</a-form-item> name="modelName"
</a-col> :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> >
<a-form-item label="model" name="model" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"> <a-input
<a-input v-model:value="state.vm.form.model" placeholder="请输入" /> v-model:value="state.vm.form.modelName"
</a-form-item> placeholder="请输入"
</a-col> />
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> </a-form-item>
<a-form-item label="输出token" name="maxTokens" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"> </a-col>
<a-input v-model:value="state.vm.form.maxTokens" placeholder="请输入" /> <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
</a-form-item> <a-form-item
</a-col> label="model"
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> name="model"
<a-form-item label="x-api-key" name="apiKey" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"> :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
<a-input v-model:value="state.vm.form.apiKey" placeholder="请输入" /> >
</a-form-item> <a-input
</a-col> v-model:value="state.vm.form.model"
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> placeholder="请输入"
<a-form-item label="请求地址" name="url" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"> />
<a-input v-model:value="state.vm.form.url" placeholder="请输入" /> </a-form-item>
</a-form-item> </a-col>
</a-col> <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> <a-form-item
<a-form-item label="模型版本" name="anthropicVersion" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"> label="x-api-key"
<a-input v-model:value="state.vm.form.anthropicVersion" placeholder="请输入" /> name="apiKey"
</a-form-item> :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
</a-col> >
<a-input
v-model:value="state.vm.form.apiKey"
placeholder="请输入"
/>
</a-form-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<a-form-item
label="max_tokens"
name="maxTokens"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
>
<a-input
v-model:value="state.vm.form.maxTokens"
placeholder="请输入"
/>
</a-form-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<a-form-item
label="模型版本"
name="anthropicVersion"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
>
<a-input
v-model:value="state.vm.form.anthropicVersion"
placeholder="请输入"
/>
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item
label="请求地址"
name="url"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
>
<a-input v-model:value="state.vm.form.url" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item
label="system上下文模板"
name="systemTemplate"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
>
<a-textarea
v-model:value="state.vm.form.systemTemplate"
placeholder="可为空,非必填"
:rows="10"
/>
</a-form-item>
</a-col>
</a-row> </a-row>
</a-form> </a-form>
</a-spin> </a-spin>
</a-modal> </a-modal>
</template> </template>

View File

@ -30,11 +30,11 @@ let visible = ref(false);
<WorkOrderStatistics/> <WorkOrderStatistics/>
</a-col> </a-col>
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"> <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
<a href="https://gitee.com/hzy6/HzyAdmin/stargazers" target="_black"> <!-- <a href="https://gitee.com/hzy6/HzyAdmin/stargazers" target="_black">
<img <img
src="https://gitee.com/hzy6/HzyAdmin/widgets/widget_card.svg?colors=eae9d7,2e2f29,272822,484a45,eae9d7,747571" src="https://gitee.com/hzy6/HzyAdmin/widgets/widget_card.svg?colors=eae9d7,2e2f29,272822,484a45,eae9d7,747571"
style="width: 100%; height: 320px"/> style="width: 100%; height: 320px"/>
</a> </a> -->
</a-col> </a-col>
</a-row> </a-row>
</div> </div>

View File

@ -39,7 +39,7 @@ public class TImageConfigService : ApplicationService<IRepository<T_Image_Config
.WhereIf(pagingSearchInput != null && !string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name), w => w.Name.Contains(pagingSearchInput.Search.Name ?? "")) .WhereIf(pagingSearchInput != null && !string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name), w => w.Name.Contains(pagingSearchInput.Search.Name ?? ""))
.WhereIf(pagingSearchInput.Search?.TenantId != null, .WhereIf(pagingSearchInput.Search?.TenantId != null,
w => w.TenantId == pagingSearchInput.Search.TenantId) w => w.TenantId == pagingSearchInput.Search.TenantId)
.WhereIf(pagingSearchInput != null && pagingSearchInput.Search?.ImageType > -1, w => w.ImageType == pagingSearchInput.Search.ImageType) .WhereIf(pagingSearchInput != null && pagingSearchInput.Search?.ImageType > 0, w => w.ImageType == pagingSearchInput.Search.ImageType)
.OrderByDescending(w => w.Id) .OrderByDescending(w => w.Id)
.Select(w => new .Select(w => new
{ {

View File

@ -26,17 +26,12 @@ public class T_Model_ConfigService : ApplicationService<IRepository<T_Model_Conf
w => w.TenantId==pagingSearchInput.Search.TenantId) w => w.TenantId==pagingSearchInput.Search.TenantId)
//模型名称
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.ModelName),
w => w.ModelName.Contains(pagingSearchInput.Search.ModelName ?? ""))
.OrderByDescending(w => w.Id) .OrderByDescending(w => w.Id)
.Select(w => new .Select(w => new
{ {
w.Id, w.Id,
w.ModelName,w.Model,w.MaxTokens,w.ApiKey,w.Url,w.AnthropicVersion,w.CreateTime,w.UpdateTime,w.TenantId, w.ModelName,w.Model,w.MaxTokens,w.ApiKey,w.Url,w.AnthropicVersion,w.CreateTime,w.UpdateTime,w.TenantId,w.SystemTemplate,
// w.LastModificationTime, // w.LastModificationTime,
// w.CreationTime // w.CreationTime
}) })

View File

@ -1,4 +1,4 @@
namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps; namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
/// <summary> /// <summary>
/// 角色和角色类型关联表 /// 角色和角色类型关联表

View File

@ -21,7 +21,7 @@ public class T_Model_Config : DefaultEntityV4
/// <summary> /// <summary>
/// 输出token => 备注: 模型运行最大的max_tokens /// max_tokens => 备注: 模型运行最大的max_tokens
/// </summary> /// </summary>
public Int32 MaxTokens { get; set; } public Int32 MaxTokens { get; set; }
@ -55,5 +55,11 @@ public class T_Model_Config : DefaultEntityV4
/// </summary> /// </summary>
public DateTime UpdateTime { get; set; } public DateTime UpdateTime { get; set; }
/// <summary>
/// system上下文模板 => 备注: system上下文模板
/// </summary>
public string? SystemTemplate { get; set; }
} }

View File

@ -424,7 +424,7 @@
</member> </member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.MaxTokens"> <member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.MaxTokens">
<summary> <summary>
输出token => 备注: 模型运行最大的max_tokens max_tokens => 备注: 模型运行最大的max_tokens
</summary> </summary>
</member> </member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.ApiKey"> <member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.ApiKey">
@ -452,6 +452,11 @@
修改时间 => 备注: 修改时间 修改时间 => 备注: 修改时间
</summary> </summary>
</member> </member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.SystemTemplate">
<summary>
system上下文模板 => 备注: system上下文模板
</summary>
</member>
<member name="T:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_User"> <member name="T:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_User">
<summary> <summary>
用户表 用户表