Merge pull request '🎨 管理指定群组新增模型可选范围限制' (#84) from hotfix into main

Reviewed-on: lxh/go-wxhelper#84
This commit is contained in:
李寻欢 2024-07-16 15:40:20 +08:00
commit 0f092977ba
3 changed files with 7 additions and 3 deletions

View File

@ -102,6 +102,7 @@ ai:
models:
- name: ChatGPT-4
model: gpt-4
canManager: false
- name: 讯飞星火v3.1
model: SparkDesk-v3.1
- name: 讯飞星火v3.5
@ -116,8 +117,10 @@ ai:
model: StepChat
- name: 豆包Lite-4k
model: Doubao-lite-4k
canManager: true
- name: 豆包Pro-4k
model: Doubao-pro-4k
canManager: true
# 资源配置
# map[k]v结构k 会变成全小写,所以这儿不能用大写字母

View File

@ -15,6 +15,7 @@ type ai struct {
// aiModel
// @description: AI模型
type aiModel struct {
Name string `json:"name" yaml:"name"` // 模型名称
Model string `json:"dto" yaml:"dto"` // 模型代码
Name string `json:"name" yaml:"name"` // 模型名称
Model string `json:"dto" yaml:"dto"` // 模型代码
CanManager bool `json:"canManager" yaml:"canManager"` // 是否可以在manager页面中选择
}

View File

@ -53,7 +53,7 @@
<select class="block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-green-600 sm:text-sm sm:leading-6" onchange="aiModelChange(event, {{.info.Wxid}})">
{{$useModel := .info.AiModel}}
{{ range $.aiModels }}
<option value="{{.Model}}" {{ if eq $useModel .Model}}selected{{ end }}>
<option value="{{.Model}}" {{ if eq $useModel .Model}}selected{{ end }} {{ if not .CanManager}}disabled{{ end }}>
{{.Name}}
</option>
{{ end }}