Browse Source

恢复 fasgpt 相关接口

boweniac 1 month ago
parent
commit
e0c6809f92
3 changed files with 27 additions and 5 deletions
  1. 2 1
      desc/all.api
  2. 16 2
      internal/handler/routes.go
  3. 9 2
      internal/types/types.go

+ 2 - 1
desc/all.api

@@ -43,4 +43,5 @@ import "./wechat/credit_usage.api"
 import "./wechat/pay_recharge.api"
 import "./wechat/whatsapp.api"
 import "./wechat/whatsapp_channel.api"
-import "./wechat/api_key.api"
+import "./wechat/api_key.api"
+import "./wechat/fastgpt.api"

+ 16 - 2
internal/handler/routes.go

@@ -34,6 +34,7 @@ import (
 	dashboard "wechat-api/internal/handler/dashboard"
 	employee "wechat-api/internal/handler/employee"
 	employee_config "wechat-api/internal/handler/employee_config"
+	fastgpt "wechat-api/internal/handler/fastgpt"
 	label "wechat-api/internal/handler/label"
 	label_relationship "wechat-api/internal/handler/label_relationship"
 	label_tagging "wechat-api/internal/handler/label_tagging"
@@ -52,7 +53,6 @@ import (
 	wxcarduser "wechat-api/internal/handler/wxcarduser"
 	wxcardvisit "wechat-api/internal/handler/wxcardvisit"
 	xiaoice "wechat-api/internal/handler/xiaoice"
-	
 	"wechat-api/internal/svc"
 
 	"github.com/zeromicro/go-zero/rest"
@@ -876,7 +876,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				},
 			}...,
 		),
-		//rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
 		rest.WithPrefix("/v1"),
 	)
 
@@ -2097,4 +2096,19 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 		),
 		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
 	)
+
+	server.AddRoutes(
+		[]rest.Route{
+			{
+				Method:  http.MethodGet,
+				Path:    "/api/fastgpt/set_token",
+				Handler: fastgpt.SetTokenHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/api/fastgpt/create",
+				Handler: fastgpt.CreateFastgptHandler(serverCtx),
+			},
+		},
+	)
 }

+ 9 - 2
internal/types/types.go

@@ -1984,8 +1984,8 @@ type StdCompApiResp struct {
 
 // swagger:model FastgptSpecResp
 type FastgptSpecResp struct {
-	ResponseData []map[string]any `json:"responseData,omitempty"`
-	NewVariables map[string]any   `json:"newVariables,omitempty"`
+	ResponseData []map[string]string `json:"responseData,omitempty"`
+	NewVariables map[string]string   `json:"newVariables,omitempty"`
 }
 
 type ChatCompletionAudio struct {
@@ -4225,3 +4225,10 @@ type ApiKeyListReq struct {
 	OrganizationId *uint64 `json:"organization_id,optional"`
 }
 
+// swagger:model CreateInfo
+type CreateInfo struct {
+	// Translated Name | 展示名称
+	UserName string `json:"username"`
+	// Name | 部门名称
+	Title *string `json:"title"`
+}