diff --git a/api/core/types/config.go b/api/core/types/config.go
index 32adbe52..72e9dbd6 100644
--- a/api/core/types/config.go
+++ b/api/core/types/config.go
@@ -113,7 +113,8 @@ type SystemConfig struct {
InitImgCalls int `json:"init_img_calls"`
VipMonthCalls int `json:"vip_month_calls"` // 会员每个赠送的调用次数
EnabledRegister bool `json:"enabled_register"`
- EnabledMsg bool `json:"enabled_msg"` // 启用短信验证码服务
- EnabledDraw bool `json:"enabled_draw"` // 启动 AI 绘画功能
- RewardImg string `json:"reward_img"` // 众筹收款二维码地址
+ EnabledMsg bool `json:"enabled_msg"` // 启用短信验证码服务
+ EnabledDraw bool `json:"enabled_draw"` // 启动 AI 绘画功能
+ RewardImg string `json:"reward_img"` // 众筹收款二维码地址
+ EnabledFunction bool `json:"enabled_function"` // 启用 API 函数功能
}
diff --git a/api/handler/chat_handler.go b/api/handler/chat_handler.go
index 0a7fafac..eceb0085 100644
--- a/api/handler/chat_handler.go
+++ b/api/handler/chat_handler.go
@@ -203,14 +203,16 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session *types.ChatSessio
req.Temperature = h.App.ChatConfig.OpenAI.Temperature
req.MaxTokens = h.App.ChatConfig.OpenAI.MaxTokens
// OpenAI 支持函数功能
- var functions = make([]types.Function, 0)
- for _, f := range types.InnerFunctions {
- if !h.App.SysConfig.EnabledDraw && f.Name == types.FuncMidJourney {
- continue
+ if h.App.SysConfig.EnabledFunction {
+ var functions = make([]types.Function, 0)
+ for _, f := range types.InnerFunctions {
+ if !h.App.SysConfig.EnabledDraw && f.Name == types.FuncMidJourney {
+ continue
+ }
+ functions = append(functions, f)
}
- functions = append(functions, f)
+ req.Functions = functions
}
- req.Functions = functions
default:
utils.ReplyMessage(ws, "不支持的平台:"+session.Model.Platform+",请联系管理员!")
utils.ReplyMessage(ws, "")
diff --git a/web/src/views/admin/SysConfig.vue b/web/src/views/admin/SysConfig.vue
index c4a9cda7..619bdcee 100644
--- a/web/src/views/admin/SysConfig.vue
+++ b/web/src/views/admin/SysConfig.vue
@@ -18,12 +18,46 @@
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -122,7 +156,7 @@ import {onMounted, reactive, ref} from "vue";
import {httpGet, httpPost} from "@/utils/http";
import Compressor from "compressorjs";
import {ElMessage} from "element-plus";
-import {UploadFilled} from "@element-plus/icons-vue";
+import {InfoFilled, UploadFilled} from "@element-plus/icons-vue";
const system = ref({models: []})
const chat = ref({
@@ -250,6 +284,12 @@ const uploadRewardImg = (file) => {
line-height 1.5;
}
+ .el-icon {
+ font-size 16px
+ margin-left 10px
+ cursor pointer
+ }
+
.uploader-icon {
font-size 24px
position relative