修改后台

This commit is contained in:
zpc 2024-08-12 06:29:25 +08:00
parent f10e70b9d0
commit 3c6a8ccfca
9 changed files with 188 additions and 61 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-BDfjS8Pq.js"></script> <script type="module" crossorigin src="/static/js/index-Cw_NB0vp.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

@ -1 +0,0 @@
.hzy-layout .ant-layout-header{position:relative;z-index:6;width:100%;height:auto!important;line-height:normal!important}.hzy-layout .hzy-layout-header{padding:0;position:relative;display:flex;align-items:center;height:48px!important;transition:background-color .1s;-moz-transition:background-color .1s;-webkit-transition:background-color .1s;-o-transition:background-color .1s}.hzy-layout .hzy-layout-header .hzy-header-btn{padding:0 8px;cursor:pointer;height:100%;display:inline-flex;justify-content:center;align-items:center}.hzy-layout .hzy-layout-header .hzy-header-btn:hover{background:var(--091c5174)}

View File

@ -25,6 +25,7 @@ const state = reactive({
total: 100, total: 100,
columns: [] as any, columns: [] as any,
data: [] as any, data: [] as any,
scroll: { x: "100vw", y: "60vh" },
}); });
// //
@ -140,6 +141,11 @@ 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">
@ -212,20 +218,20 @@ function exportExcel() {
<!-- table-col --> <!-- table-col -->
<template #table-col> <template #table-col>
<template v-for="item,index in state.columns.filter((w:any) => w.show)" :key="item.fieldName"> <template v-for="item,index in state.columns.filter((w:any) => w.show)" :key="item.fieldName">
<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 <a-table-column v-if="(item.fieldName=='systemTemplate'||item.fieldName=='headersTemplate'||item.fieldName=='requestTemplate')"
title="模型上下文模板" :title="item.title" :data-index="item.fieldName" :sorter="item.sort ? { multiple: index + 1 } : false"
data-index="systemTemplate"
min-width="300px" min-width="300px"
width="500px" width="500px"
:resizable="true" :resizable="true"
> >
<template #default="{ record }"> <template #default="{ record }">
<div style="width: 100%; min-height: 150px;max-height: 300px; overflow: auto"> <div style="width: 100%; min-height: 150px;max-height: 300px; overflow: auto">
{{ record.systemTemplate }} {{ record[item.fieldName] }}
</div> </div>
</template> </template>
</a-table-column> </a-table-column>
<a-table-column v-else :title="item.title" :data-index="item.fieldName" :sorter="item.sort ? { multiple: index + 1 } : false" width="150px" />
</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

@ -70,7 +70,7 @@ function save() {
:title="state.vm.id ? '编辑' : '新建'" :title="state.vm.id ? '编辑' : '新建'"
centered centered
@ok="state.visible = false" @ok="state.visible = false"
:width="1200" :width="1400"
> >
<template #footer> <template #footer>
<a-button type="primary" :loading="state.loading" @click="save()"> <a-button type="primary" :loading="state.loading" @click="save()">
@ -86,7 +86,7 @@ function save() {
<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="4" :sm="4" :md="4" :lg="4" :xl="4">
<a-form-item <a-form-item
label="模型名称" label="模型名称"
name="modelName" name="modelName"
@ -98,9 +98,9 @@ function save() {
/> />
</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="4" :sm="4" :md="4" :lg="4" :xl="4">
<a-form-item <a-form-item
label="model" label="模型model"
name="model" name="model"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
> >
@ -110,19 +110,7 @@ function save() {
/> />
</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="4" :sm="4" :md="4" :lg="4" :xl="4">
<a-form-item
label="x-api-key"
name="apiKey"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
>
<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 <a-form-item
label="max_tokens" label="max_tokens"
name="maxTokens" name="maxTokens"
@ -134,11 +122,20 @@ function save() {
/> />
</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="4" :sm="4" :md="4" :lg="4" :xl="4">
<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="4" :sm="4" :md="4" :lg="4" :xl="4">
<a-form-item <a-form-item
label="模型版本" label="模型版本"
name="anthropicVersion" name="anthropicVersion"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
> >
<a-input <a-input
v-model:value="state.vm.form.anthropicVersion" v-model:value="state.vm.form.anthropicVersion"
@ -146,30 +143,85 @@ function save() {
/> />
</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="12" :sm="12" :md="12" :lg="12" :xl="12">
<a-form-item <a-form-item
label="请求地址" label="是否默认"
name="url" name="isDefabult"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
> >
<a-input v-model:value="state.vm.form.url" placeholder="请输入" /> <a-select v-model:value="state.vm.form.isDefabult">
<a-select-option :value="false"></a-select-option>
<a-select-option :value="true"></a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<a-form-item
label="key x-api-key"
name="apiKey"
>
<a-input
v-model:value="state.vm.form.apiKey"
placeholder="请输入"
/>
</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 <a-form-item
label="system上下文模板" label="system上下文模板"
name="systemTemplate" name="systemTemplate"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
> >
<a-textarea <a-textarea
v-model:value="state.vm.form.systemTemplate" v-model:value="state.vm.form.systemTemplate"
placeholder="可为空,非必填" placeholder="可为空,非必填"
:rows="10" :rows="10"
/> />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item
label="请求模板"
name="requestTemplate"
>
<a-textarea
v-model:value="state.vm.form.requestTemplate"
placeholder="可为空,非必填"
:rows="10"
/>
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item
label="headers对象"
name="headersTemplate"
>
<a-textarea
v-model:value="state.vm.form.headersTemplate"
placeholder="可为空,非必填"
:rows="10"
/>
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item
label="返回数据模板"
name="responseTemplate"
>
<a-textarea
v-model:value="state.vm.form.responseTemplate"
placeholder="可为空,非必填"
:rows="10"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</a-spin> </a-spin>

View File

@ -1,4 +1,4 @@
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps; using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
namespace MiaoYu.Api.Admin.ApplicationServices.Apps; namespace MiaoYu.Api.Admin.ApplicationServices.Apps;
/// <summary> /// <summary>
@ -20,20 +20,38 @@ public class T_Model_ConfigService : ApplicationService<IRepository<T_Model_Conf
public async Task<PagingView> FindListAsync(PagingSearchInput<T_Model_Config> pagingSearchInput) public async Task<PagingView> FindListAsync(PagingSearchInput<T_Model_Config> pagingSearchInput)
{ {
var query = this._defaultRepository.Select var query = this._defaultRepository.Select
//项目
.WhereIf(pagingSearchInput.Search?.TenantId!=null,
w => w.TenantId==pagingSearchInput.Search.TenantId)
//项目
.WhereIf(pagingSearchInput.Search?.TenantId != null,
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.SystemTemplate, w.ModelName,
// w.LastModificationTime, w.Model,
// w.CreationTime w.MaxTokens,
w.ApiKey,
w.Url,
w.AnthropicVersion,
w.CreateTime,
w.UpdateTime,
w.TenantId,
w.SystemTemplate,
w.RequestTemplate,
w.HeadersTemplate,
w.ResponseTemplate,
w.IsDefabult,
// w.LastModificationTime,
// w.CreationTime
}) })
; ;
@ -64,19 +82,19 @@ public class T_Model_ConfigService : ApplicationService<IRepository<T_Model_Conf
/// </summary> /// </summary>
/// <param name="id">id</param> /// <param name="id">id</param>
/// <returns></returns> /// <returns></returns>
public async Task<Dictionary<string,object>> FindFormAsync(int id) public async Task<Dictionary<string, object>> FindFormAsync(int id)
{ {
var res = new Dictionary<string, object>(); var res = new Dictionary<string, object>();
var form = await this._defaultRepository.FindByIdAsync(id); var form = await this._defaultRepository.FindByIdAsync(id);
form = form.NullSafe(); form = form.NullSafe();
//if (form.CreateTime == null || form.CreateTime == DateTime.MinValue) if (form.CreateTime == null || form.CreateTime == DateTime.MinValue)
//{ {
// form.CreateTime = DateTime.Now; form.CreateTime = DateTime.Now;
//} }
//if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue) if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue)
//{ {
// form.UpdateTime = DateTime.Now; form.UpdateTime = DateTime.Now;
//} }
res[nameof(id)] = id; res[nameof(id)] = id;
res[nameof(form)] = form; res[nameof(form)] = form;
return res; return res;
@ -89,6 +107,14 @@ public class T_Model_ConfigService : ApplicationService<IRepository<T_Model_Conf
/// <returns></returns> /// <returns></returns>
public Task SaveFormAsync(T_Model_Config form) public Task SaveFormAsync(T_Model_Config form)
{ {
if (form.CreateTime == null || form.CreateTime == DateTime.MinValue)
{
form.CreateTime = DateTime.Now;
}
if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue)
{
form.UpdateTime = DateTime.Now;
}
return this._defaultRepository.InsertOrUpdateAsync(form); return this._defaultRepository.InsertOrUpdateAsync(form);
} }

View File

@ -2,7 +2,7 @@
// //
"ConnectionStrings": { "ConnectionStrings": {
// redis // redis
"Redis": "127.0.0.1:6379,password=123456,defaultDatabase=0" "Redis": "124.220.55.158:6379,defaultDatabase=1"
}, },
// pi // pi
"AdminRepositoryOptions": { "AdminRepositoryOptions": {

View File

@ -2,7 +2,7 @@
// //
"ConnectionStrings": { "ConnectionStrings": {
// redis // redis
"Redis": "127.0.0.1:6379,password=123456,defaultDatabase=0" "Redis": "192.168.195.5:6379,defaultDatabase=1"
}, },
// pi // pi
"AdminRepositoryOptions": { "AdminRepositoryOptions": {

View File

@ -15,7 +15,7 @@ public class T_Model_Config : DefaultEntityV4
/// <summary> /// <summary>
/// model => 备注: 模型model /// 模型model => 备注: 模型model
/// </summary> /// </summary>
public string? Model { get; set; } public string? Model { get; set; }
@ -27,13 +27,13 @@ public class T_Model_Config : DefaultEntityV4
/// <summary> /// <summary>
/// x-api-key => 备注: 模型key x-api-key /// key x-api-key => 备注: 模型key x-api-key
/// </summary> /// </summary>
public string? ApiKey { get; set; } public string? ApiKey { get; set; }
/// <summary> /// <summary>
/// 请求地址 => 备注: 模型请求地址 /// 模型请求地址 => 备注: 模型请求地址
/// </summary> /// </summary>
public string? Url { get; set; } public string? Url { get; set; }
@ -57,9 +57,33 @@ public class T_Model_Config : DefaultEntityV4
/// <summary> /// <summary>
/// system上下文模板 => 备注: system上下文模板 /// 上下文模板 => 备注: system上下文模板
/// </summary> /// </summary>
public string? SystemTemplate { get; set; } public string? SystemTemplate { get; set; }
/// <summary>
/// 请求模板 => 备注: 请求模板
/// </summary>
public string? RequestTemplate { get; set; }
/// <summary>
/// headers对象 => 备注: headers对象
/// </summary>
public string? HeadersTemplate { get; set; }
/// <summary>
/// 返回数据模板 => 备注: 返回数据模板
/// </summary>
public string? ResponseTemplate { get; set; }
/// <summary>
/// 是否默认 => 备注: 是否默认
/// </summary>
public Boolean? IsDefabult { get; set; }
} }

View File

@ -419,7 +419,7 @@
</member> </member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.Model"> <member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.Model">
<summary> <summary>
model => 备注: 模型model 模型model => 备注: 模型model
</summary> </summary>
</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">
@ -429,12 +429,12 @@
</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">
<summary> <summary>
x-api-key => 备注: 模型key x-api-key key x-api-key => 备注: 模型key x-api-key
</summary> </summary>
</member> </member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.Url"> <member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.Url">
<summary> <summary>
请求地址 => 备注: 模型请求地址 模型请求地址 => 备注: 模型请求地址
</summary> </summary>
</member> </member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.AnthropicVersion"> <member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.AnthropicVersion">
@ -454,7 +454,27 @@
</member> </member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.SystemTemplate"> <member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.SystemTemplate">
<summary> <summary>
system上下文模板 => 备注: system上下文模板 上下文模板 => 备注: system上下文模板
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.RequestTemplate">
<summary>
请求模板 => 备注: 请求模板
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.HeadersTemplate">
<summary>
headers对象 => 备注: headers对象
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.ResponseTemplate">
<summary>
返回数据模板 => 备注: 返回数据模板
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Model_Config.IsDefabult">
<summary>
是否默认 => 备注: 是否默认
</summary> </summary>
</member> </member>
<member name="T:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_User"> <member name="T:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_User">