支持微模型绑定 Dalle 绘图的 API KEY

This commit is contained in:
RockYang
2025-01-08 10:50:37 +08:00
parent eefd36562d
commit b463608ab7
3 changed files with 8 additions and 3 deletions

View File

@@ -8,6 +8,7 @@
- 功能优化:登录,注册页面允许替换用户自己的 Logo 和 Title - 功能优化:登录,注册页面允许替换用户自己的 Logo 和 Title
- Bug 修复:修复 OpenAI 实时语音通话没有检测用户算力不足的 Bug - Bug 修复:修复 OpenAI 实时语音通话没有检测用户算力不足的 Bug
- 功能新增:管理后台增加算力日志查询功能,支持按用户,按模型,按日期,按类型查询算力日志 - 功能新增:管理后台增加算力日志查询功能,支持按用户,按模型,按日期,按类型查询算力日志
- 功能优化:支持为模型绑定 Dalle 和 chat 类型的 API KEY
## v4.1.8 ## v4.1.8

View File

@@ -16,6 +16,7 @@ import (
"geekai/store/vo" "geekai/store/vo"
"geekai/utils" "geekai/utils"
"geekai/utils/resp" "geekai/utils/resp"
"strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gorm.io/gorm" "gorm.io/gorm"
@@ -71,16 +72,18 @@ func (h *ApiKeyHandler) Save(c *gin.Context) {
resp.SUCCESS(c, keyVo) resp.SUCCESS(c, keyVo)
} }
// List 获取 API KEY 列表
func (h *ApiKeyHandler) List(c *gin.Context) { func (h *ApiKeyHandler) List(c *gin.Context) {
status := h.GetBool(c, "status") status := h.GetBool(c, "status")
t := h.GetTrim(c, "type") t := c.Query("type")
session := h.DB.Session(&gorm.Session{}) session := h.DB.Session(&gorm.Session{})
if status { if status {
session = session.Where("enabled", true) session = session.Where("enabled", true)
} }
if t != "" { if t != "" {
session = session.Where("type", t) types := strings.Split(t, "|")
session = session.Where("type IN ?", types)
} }
var items []model.ApiKey var items []model.ApiKey

View File

@@ -130,6 +130,7 @@
<el-select v-model="item.key_id" placeholder="请选择 API KEY" filterable clearable> <el-select v-model="item.key_id" placeholder="请选择 API KEY" filterable clearable>
<el-option v-for="v in apiKeys" :value="v.id" :label="v.name" :key="v.id"> <el-option v-for="v in apiKeys" :value="v.id" :label="v.name" :key="v.id">
{{ v.name }} {{ v.name }}
<el-tag type="primary" size="small" class="ml-1 mr-1">{{ v.type }}</el-tag>
<el-text type="info" size="small">{{ substr(v.api_url, 50) }}</el-text> <el-text type="info" size="small">{{ substr(v.api_url, 50) }}</el-text>
</el-option> </el-option>
</el-select> </el-select>
@@ -194,7 +195,7 @@ const type = ref([
// 获取 API KEY // 获取 API KEY
const apiKeys = ref([]); const apiKeys = ref([]);
httpGet("/api/admin/apikey/list?type=chat") httpGet("/api/admin/apikey/list?type=chat|dalle")
.then((res) => { .then((res) => {
apiKeys.value = res.data; apiKeys.value = res.data;
}) })