Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
koderover
zadig
提交
ee40ddd8
zadig
项目概览
koderover
/
zadig
9 个月 前同步成功
通知
10
Star
2407
Fork
754
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
zadig
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ee40ddd8
编写于
7月 31, 2023
作者:
P
Petrus
提交者:
GitHub
7月 31, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add CheckLLMIntegration api (#2894)
Signed-off-by:
N
Patrick Zhao
<
zhaoyu@koderover.com
>
上级
d05a3438
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
118 addition
and
0 deletion
+118
-0
pkg/microservice/aslan/core/system/handler/llm.go
pkg/microservice/aslan/core/system/handler/llm.go
+20
-0
pkg/microservice/aslan/core/system/handler/router.go
pkg/microservice/aslan/core/system/handler/router.go
+1
-0
pkg/microservice/aslan/core/system/service/llm.go
pkg/microservice/aslan/core/system/service/llm.go
+15
-0
pkg/microservice/aslan/server/rest/doc/docs.go
pkg/microservice/aslan/server/rest/doc/docs.go
+31
-0
pkg/microservice/aslan/server/rest/doc/swagger.json
pkg/microservice/aslan/server/rest/doc/swagger.json
+31
-0
pkg/microservice/aslan/server/rest/doc/swagger.yaml
pkg/microservice/aslan/server/rest/doc/swagger.yaml
+20
-0
未找到文件。
pkg/microservice/aslan/core/system/handler/llm.go
浏览文件 @
ee40ddd8
...
...
@@ -98,6 +98,26 @@ func ListLLMIntegration(c *gin.Context) {
ctx
.
Resp
,
ctx
.
Err
=
service
.
ListLLMIntegration
(
context
.
TODO
())
}
type
checkLLMIntegrationResponse
struct
{
Check
bool
`json:"check"`
}
// @Summary Check llm integrations
// @Description Check llm integrations
// @Tags system
// @Accept json
// @Produce json
// @Success 200 {object} checkLLMIntegrationResponse
// @Router /api/aslan/system/llm/integration/check [get]
func
CheckLLMIntegration
(
c
*
gin
.
Context
)
{
ctx
:=
internalhandler
.
NewContext
(
c
)
defer
func
()
{
internalhandler
.
JSONResponse
(
c
,
ctx
)
}()
resp
:=
&
checkLLMIntegrationResponse
{}
resp
.
Check
,
ctx
.
Err
=
service
.
CheckLLMIntegration
(
context
.
TODO
())
ctx
.
Resp
=
resp
}
// @Summary Update a llm integration
// @Description Update a llm integration
// @Tags system
...
...
pkg/microservice/aslan/core/system/handler/router.go
浏览文件 @
ee40ddd8
...
...
@@ -352,6 +352,7 @@ func (*Router) Inject(router *gin.RouterGroup) {
{
llm
.
POST
(
"/integration"
,
CreateLLMIntegration
)
llm
.
GET
(
"/integration"
,
ListLLMIntegration
)
llm
.
GET
(
"/integration/check"
,
CheckLLMIntegration
)
llm
.
GET
(
"/integration/:id"
,
GetLLMIntegration
)
llm
.
PUT
(
"/integration/:id"
,
UpdateLLMIntegration
)
llm
.
DELETE
(
"/integration/:id"
,
DeleteLLMIntegration
)
...
...
pkg/microservice/aslan/core/system/service/llm.go
浏览文件 @
ee40ddd8
...
...
@@ -26,6 +26,21 @@ import (
"github.com/koderover/zadig/pkg/tool/log"
)
func
CheckLLMIntegration
(
ctx
context
.
Context
)
(
bool
,
error
)
{
count
,
err
:=
commonrepo
.
NewLLMIntegrationColl
()
.
Count
(
ctx
)
if
err
!=
nil
{
fmtErr
:=
fmt
.
Errorf
(
"CheckLLMIntegration err: %w"
,
err
)
log
.
Error
(
fmtErr
)
return
false
,
e
.
ErrListLLMIntegration
.
AddErr
(
fmtErr
)
}
if
count
==
0
{
return
false
,
nil
}
return
true
,
nil
}
func
GetLLMIntegration
(
ctx
context
.
Context
,
id
string
)
(
*
commonmodels
.
LLMIntegration
,
error
)
{
llmIntegration
,
err
:=
commonrepo
.
NewLLMIntegrationColl
()
.
FindByID
(
ctx
,
id
)
if
err
!=
nil
{
...
...
pkg/microservice/aslan/server/rest/doc/docs.go
浏览文件 @
ee40ddd8
...
...
@@ -2154,6 +2154,29 @@ const docTemplate = `{
}
}
},
"/api/aslan/system/llm/integration/check": {
"get": {
"description": "Check llm integrations",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Check llm integrations",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.checkLLMIntegrationResponse"
}
}
}
}
},
"/api/aslan/system/llm/integration/{id}": {
"get": {
"description": "Get a llm integration",
...
...
@@ -2792,6 +2815,14 @@ const docTemplate = `{
}
}
},
"handler.checkLLMIntegrationResponse": {
"type": "object",
"properties": {
"check": {
"type": "boolean"
}
}
},
"handler.createServiceTemplateRequest": {
"type": "object",
"required": [
...
...
pkg/microservice/aslan/server/rest/doc/swagger.json
浏览文件 @
ee40ddd8
...
...
@@ -2145,6 +2145,29 @@
}
}
},
"/api/aslan/system/llm/integration/check"
:
{
"get"
:
{
"description"
:
"Check llm integrations"
,
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"system"
],
"summary"
:
"Check llm integrations"
,
"responses"
:
{
"200"
:
{
"description"
:
"OK"
,
"schema"
:
{
"$ref"
:
"#/definitions/handler.checkLLMIntegrationResponse"
}
}
}
}
},
"/api/aslan/system/llm/integration/{id}"
:
{
"get"
:
{
"description"
:
"Get a llm integration"
,
...
...
@@ -2783,6 +2806,14 @@
}
}
},
"handler.checkLLMIntegrationResponse"
:
{
"type"
:
"object"
,
"properties"
:
{
"check"
:
{
"type"
:
"boolean"
}
}
},
"handler.createServiceTemplateRequest"
:
{
"type"
:
"object"
,
"required"
:
[
...
...
pkg/microservice/aslan/server/rest/doc/swagger.yaml
浏览文件 @
ee40ddd8
...
...
@@ -167,6 +167,11 @@ definitions:
name
:
type
:
string
type
:
object
handler.checkLLMIntegrationResponse
:
properties
:
check
:
type
:
boolean
type
:
object
handler.createServiceTemplateRequest
:
properties
:
product_name
:
...
...
@@ -3416,6 +3421,21 @@ paths:
summary
:
Update a llm integration
tags
:
-
system
/api/aslan/system/llm/integration/check
:
get
:
consumes
:
-
application/json
description
:
Check llm integrations
produces
:
-
application/json
responses
:
"
200"
:
description
:
OK
schema
:
$ref
:
'
#/definitions/handler.checkLLMIntegrationResponse'
summary
:
Check llm integrations
tags
:
-
system
/api/aslan/system/webhook/config
:
get
:
consumes
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录