修改问题

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" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<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">
</head>

View File

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

View File

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

View File

@ -22,7 +22,7 @@ const state = reactive({
state: false,
vm: {
name: undefined,
imageType: undefined,
imageType: '-1',
},
sort: [] as any[],
},
@ -135,7 +135,7 @@ async function findList() {
state.loading = false;
if (result.code != 200) return;
state.page = result.data.page;
state.size = 50;//result.data.size;
state.size = result.data.size;
state.total = result.data.total;
state.columns = columns,//result.data.columns;
state.data = result.data.dataSource;
@ -193,15 +193,19 @@ async function imageUpdate(image: any) {
<TableCurd ref="refTableCurd" :config="state" @change="(changeTable) => {
state.page = changeTable.pagination.current ?? 1;
state.size = changeTable.pagination.pageSize ?? state.size;
console.log(changeTable);
state.search.sort = changeTable.sorter instanceof Array ? [...changeTable.sorter] : [changeTable.sorter];
findList();
}
" @show-size-change="({ current, size }) => {
"
@show-size-change="({ current, size }) => {
state.page = current == 0 ? 1 : current;
console.log(size,state);
state.size = size;
findList();
}
">
"
>
<!-- search -->
<template #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" />
</a-form-item>
</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-->
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="text-right">
<a-space :size="8">
@ -216,8 +211,21 @@ function exportExcel() {
</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">
<a-table-column :title="item.title" :data-index="item.fieldName" :sorter="item.sort ? { multiple: index + 1 } : false" />
<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
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>
<!-- 操作 -->
<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>
import { reactive, ref } from "vue";
import { FormInstance } from "ant-design-vue";
import Tools from "@/core/utils/Tools";
import T_Model_ConfigService from "@/services/apps/T_Model_Configs/T_Model_ConfigService";
import { reactive, ref } from "vue";
import { FormInstance } from "ant-design-vue";
import Tools from "@/core/utils/Tools";
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({
vm: {
id: "",
form: {} as any,
},
visible: false,
loading: false,
});
const state = reactive({
vm: {
id: "",
form: {} as any,
},
visible: false,
loading: false,
});
//
const refForm = ref<FormInstance>();
//
const refForm = ref<FormInstance>();
//
defineExpose({
/**
* 打开表单初始化
* @param key
*/
open: (key: string = "") => {
state.visible = true;
if (state.visible) {
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;
}
});
//
defineExpose({
/**
* 打开表单初始化
* @param key
*/
open: (key: string = "") => {
state.visible = true;
if (state.visible) {
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;
}
});
}
</script>
<template>
<a-modal v-model:open="state.visible" :title="state.vm.id ? '编辑' : '新建'" centered @ok="state.visible = false" :width="800">
<template #footer>
<a-button type="primary" :loading="state.loading" @click="save()"> 提交</a-button>
<a-button @click="state.visible = false">关闭</a-button>
<a-modal
v-model:open="state.visible"
:title="state.vm.id ? '编辑' : '新建'"
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>
<a-spin :spinning="state.loading">
<a-form ref="refForm" layout="vertical" :model="state.vm.form">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="项目" name="tenantId">
<hm-tenant-select v-model:value="state.vm.form.tenantId" />
</a-form-item>
</a-col>
<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-input v-model:value="state.vm.form.modelName" placeholder="请输入" />
</a-form-item>
</a-col>
<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 v-model:value="state.vm.form.model" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="输出token" 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="24" :sm="24" :md="24" :lg="24" :xl="24">
<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="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="模型版本" name="anthropicVersion" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.anthropicVersion" placeholder="请输入" />
</a-form-item>
</a-col>
<a-spin :spinning="state.loading">
<a-form ref="refForm" layout="vertical" :model="state.vm.form">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="项目" name="tenantId">
<hm-tenant-select v-model:value="state.vm.form.tenantId" />
</a-form-item>
</a-col>
<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-input
v-model:value="state.vm.form.modelName"
placeholder="请输入"
/>
</a-form-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<a-form-item
label="model"
name="model"
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
>
<a-input
v-model:value="state.vm.form.model"
placeholder="请输入"
/>
</a-form-item>
</a-col>
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
<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
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-form>
</a-spin>
</a-modal>
</template>
</template>

View File

@ -30,11 +30,11 @@ let visible = ref(false);
<WorkOrderStatistics/>
</a-col>
<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
src="https://gitee.com/hzy6/HzyAdmin/widgets/widget_card.svg?colors=eae9d7,2e2f29,272822,484a45,eae9d7,747571"
style="width: 100%; height: 320px"/>
</a>
</a> -->
</a-col>
</a-row>
</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.Search?.TenantId != null,
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)
.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)
//模型名称
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.ModelName),
w => w.ModelName.Contains(pagingSearchInput.Search.ModelName ?? ""))
.OrderByDescending(w => w.Id)
.Select(w => new
{
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.CreationTime
})

View File

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

View File

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

View File

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