fix: change the AI routing interface (#7887)

This commit is contained in:
ssongliu
2025-02-17 15:33:57 +08:00
committed by GitHub
parent f6ee3dc75b
commit ea044d6c32
18 changed files with 304 additions and 631 deletions

View File

@@ -1,5 +1,4 @@
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
@@ -21,7 +20,7 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/aitool/domain/bind": {
"/ai/domain/bind": {
"post": {
"security": [
{
@@ -35,7 +34,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Bind domain",
"parameters": [
@@ -45,7 +44,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.WebsiteConfig"
"$ref": "#/definitions/dto.OllamaBindDomain"
}
}
],
@@ -56,7 +55,7 @@ const docTemplate = `{
}
}
},
"/aitool/domain/get": {
"/ai/domain/get": {
"post": {
"security": [
{
@@ -70,7 +69,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Get bind domain",
"parameters": [
@@ -94,7 +93,7 @@ const docTemplate = `{
}
}
},
"/aitool/gpu/load": {
"/ai/gpu/load": {
"get": {
"security": [
{
@@ -108,7 +107,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Load gpu / xpu info",
"responses": {
@@ -118,7 +117,7 @@ const docTemplate = `{
}
}
},
"/aitool/ollama/model/del": {
"/ai/ollama/model": {
"post": {
"security": [
{
@@ -132,51 +131,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"AITools"
],
"summary": "Delete Ollama model",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OllamaModelName"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"name"
],
"formatEN": "remove Ollama model [name]",
"formatZH": "删除模型 [name]",
"paramKeys": []
}
}
},
"/aitools/ollama/model": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Create Ollama model",
"parameters": [
@@ -206,7 +161,7 @@ const docTemplate = `{
}
}
},
"/aitools/ollama/model/load": {
"/ai/ollama/model/del": {
"post": {
"security": [
{
@@ -220,7 +175,51 @@ const docTemplate = `{
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Delete Ollama model",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OllamaModelName"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"name"
],
"formatEN": "remove Ollama model [name]",
"formatZH": "删除模型 [name]",
"paramKeys": []
}
}
},
"/ai/ollama/model/load": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"AI"
],
"summary": "Page Ollama models",
"parameters": [
@@ -244,7 +243,7 @@ const docTemplate = `{
}
}
},
"/aitools/ollama/model/search": {
"/ai/ollama/model/search": {
"post": {
"security": [
{
@@ -258,7 +257,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Page Ollama models",
"parameters": [
@@ -17297,41 +17296,6 @@ const docTemplate = `{
}
}
},
"dto.CCConfig": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"code": {
"type": "integer"
},
"duration": {
"type": "integer"
},
"ipBlock": {
"type": "string"
},
"ipBlockTime": {
"type": "integer"
},
"mode": {
"type": "string"
},
"res": {
"type": "string"
},
"state": {
"type": "string"
},
"threshold": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"dto.CaptchaResponse": {
"type": "object",
"properties": {
@@ -17776,26 +17740,6 @@ const docTemplate = `{
}
}
},
"dto.CommonConfig": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"code": {
"type": "integer"
},
"res": {
"type": "string"
},
"state": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"dto.CommonRecover": {
"type": "object",
"required": [
@@ -19492,29 +19436,6 @@ const docTemplate = `{
}
}
},
"dto.GeoRestrict": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"res": {
"type": "string"
},
"rules": {
"type": "array",
"items": {
"type": "string"
}
},
"state": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"dto.GroupCreate": {
"type": "object",
"required": [
@@ -20604,6 +20525,33 @@ const docTemplate = `{
"ProxyCache"
]
},
"dto.OllamaBindDomain": {
"type": "object",
"required": [
"appInstallID",
"domain"
],
"properties": {
"allowIPs": {
"type": "array",
"items": {
"type": "string"
}
},
"appInstallID": {
"type": "integer"
},
"domain": {
"type": "string"
},
"sslID": {
"type": "integer"
},
"websiteID": {
"type": "integer"
}
}
},
"dto.OllamaBindDomainReq": {
"type": "object",
"required": [
@@ -22109,14 +22057,6 @@ const docTemplate = `{
}
}
},
"dto.StateConfig": {
"type": "object",
"properties": {
"state": {
"type": "string"
}
}
},
"dto.SwapHelper": {
"type": "object",
"required": [
@@ -22315,72 +22255,6 @@ const docTemplate = `{
}
}
},
"dto.WafConfig": {
"type": "object",
"required": [
"mode",
"secret",
"state"
],
"properties": {
"mode": {
"type": "string"
},
"secret": {
"type": "string"
},
"state": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"dto.WebsiteConfig": {
"type": "object",
"properties": {
"args": {
"$ref": "#/definitions/dto.CommonConfig"
},
"cc": {
"$ref": "#/definitions/dto.CCConfig"
},
"cdn": {
"$ref": "#/definitions/dto.StateConfig"
},
"cookie": {
"$ref": "#/definitions/dto.CommonConfig"
},
"defaultUaBlack": {
"$ref": "#/definitions/dto.CommonConfig"
},
"defaultUrlBlack": {
"$ref": "#/definitions/dto.CommonConfig"
},
"fileExt": {
"$ref": "#/definitions/dto.CommonConfig"
},
"geoRestrict": {
"$ref": "#/definitions/dto.GeoRestrict"
},
"header": {
"$ref": "#/definitions/dto.CommonConfig"
},
"methodWhite": {
"$ref": "#/definitions/dto.CommonConfig"
},
"sql": {
"$ref": "#/definitions/dto.CommonConfig"
},
"waf": {
"$ref": "#/definitions/dto.WafConfig"
},
"xss": {
"$ref": "#/definitions/dto.CommonConfig"
}
}
},
"dto.XPUInfo": {
"type": "object",
"properties": {
@@ -26715,6 +26589,8 @@ var SwaggerInfo = &swag.Spec{
Description: "Top-Rated Web-based Linux Server Management Tool",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {

View File

@@ -17,7 +17,7 @@
},
"basePath": "/api/v1",
"paths": {
"/aitool/domain/bind": {
"/ai/domain/bind": {
"post": {
"security": [
{
@@ -31,7 +31,7 @@
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Bind domain",
"parameters": [
@@ -41,7 +41,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.WebsiteConfig"
"$ref": "#/definitions/dto.OllamaBindDomain"
}
}
],
@@ -52,7 +52,7 @@
}
}
},
"/aitool/domain/get": {
"/ai/domain/get": {
"post": {
"security": [
{
@@ -66,7 +66,7 @@
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Get bind domain",
"parameters": [
@@ -90,7 +90,7 @@
}
}
},
"/aitool/gpu/load": {
"/ai/gpu/load": {
"get": {
"security": [
{
@@ -104,7 +104,7 @@
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Load gpu / xpu info",
"responses": {
@@ -114,7 +114,7 @@
}
}
},
"/aitool/ollama/model/del": {
"/ai/ollama/model": {
"post": {
"security": [
{
@@ -128,51 +128,7 @@
"application/json"
],
"tags": [
"AITools"
],
"summary": "Delete Ollama model",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OllamaModelName"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"name"
],
"formatEN": "remove Ollama model [name]",
"formatZH": "删除模型 [name]",
"paramKeys": []
}
}
},
"/aitools/ollama/model": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Create Ollama model",
"parameters": [
@@ -202,7 +158,7 @@
}
}
},
"/aitools/ollama/model/load": {
"/ai/ollama/model/del": {
"post": {
"security": [
{
@@ -216,7 +172,51 @@
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Delete Ollama model",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OllamaModelName"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"name"
],
"formatEN": "remove Ollama model [name]",
"formatZH": "删除模型 [name]",
"paramKeys": []
}
}
},
"/ai/ollama/model/load": {
"post": {
"security": [
{
"ApiKeyAuth": []
},
{
"Timestamp": []
}
],
"consumes": [
"application/json"
],
"tags": [
"AI"
],
"summary": "Page Ollama models",
"parameters": [
@@ -240,7 +240,7 @@
}
}
},
"/aitools/ollama/model/search": {
"/ai/ollama/model/search": {
"post": {
"security": [
{
@@ -254,7 +254,7 @@
"application/json"
],
"tags": [
"AITools"
"AI"
],
"summary": "Page Ollama models",
"parameters": [
@@ -17293,41 +17293,6 @@
}
}
},
"dto.CCConfig": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"code": {
"type": "integer"
},
"duration": {
"type": "integer"
},
"ipBlock": {
"type": "string"
},
"ipBlockTime": {
"type": "integer"
},
"mode": {
"type": "string"
},
"res": {
"type": "string"
},
"state": {
"type": "string"
},
"threshold": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"dto.CaptchaResponse": {
"type": "object",
"properties": {
@@ -17772,26 +17737,6 @@
}
}
},
"dto.CommonConfig": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"code": {
"type": "integer"
},
"res": {
"type": "string"
},
"state": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"dto.CommonRecover": {
"type": "object",
"required": [
@@ -19488,29 +19433,6 @@
}
}
},
"dto.GeoRestrict": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"res": {
"type": "string"
},
"rules": {
"type": "array",
"items": {
"type": "string"
}
},
"state": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"dto.GroupCreate": {
"type": "object",
"required": [
@@ -20600,6 +20522,33 @@
"ProxyCache"
]
},
"dto.OllamaBindDomain": {
"type": "object",
"required": [
"appInstallID",
"domain"
],
"properties": {
"allowIPs": {
"type": "array",
"items": {
"type": "string"
}
},
"appInstallID": {
"type": "integer"
},
"domain": {
"type": "string"
},
"sslID": {
"type": "integer"
},
"websiteID": {
"type": "integer"
}
}
},
"dto.OllamaBindDomainReq": {
"type": "object",
"required": [
@@ -22105,14 +22054,6 @@
}
}
},
"dto.StateConfig": {
"type": "object",
"properties": {
"state": {
"type": "string"
}
}
},
"dto.SwapHelper": {
"type": "object",
"required": [
@@ -22311,72 +22252,6 @@
}
}
},
"dto.WafConfig": {
"type": "object",
"required": [
"mode",
"secret",
"state"
],
"properties": {
"mode": {
"type": "string"
},
"secret": {
"type": "string"
},
"state": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"dto.WebsiteConfig": {
"type": "object",
"properties": {
"args": {
"$ref": "#/definitions/dto.CommonConfig"
},
"cc": {
"$ref": "#/definitions/dto.CCConfig"
},
"cdn": {
"$ref": "#/definitions/dto.StateConfig"
},
"cookie": {
"$ref": "#/definitions/dto.CommonConfig"
},
"defaultUaBlack": {
"$ref": "#/definitions/dto.CommonConfig"
},
"defaultUrlBlack": {
"$ref": "#/definitions/dto.CommonConfig"
},
"fileExt": {
"$ref": "#/definitions/dto.CommonConfig"
},
"geoRestrict": {
"$ref": "#/definitions/dto.GeoRestrict"
},
"header": {
"$ref": "#/definitions/dto.CommonConfig"
},
"methodWhite": {
"$ref": "#/definitions/dto.CommonConfig"
},
"sql": {
"$ref": "#/definitions/dto.CommonConfig"
},
"waf": {
"$ref": "#/definitions/dto.WafConfig"
},
"xss": {
"$ref": "#/definitions/dto.CommonConfig"
}
}
},
"dto.XPUInfo": {
"type": "object",
"properties": {

View File

@@ -263,29 +263,6 @@ definitions:
- permission
- username
type: object
dto.CCConfig:
properties:
action:
type: string
code:
type: integer
duration:
type: integer
ipBlock:
type: string
ipBlockTime:
type: integer
mode:
type: string
res:
type: string
state:
type: string
threshold:
type: integer
type:
type: string
type: object
dto.CaptchaResponse:
properties:
captchaID:
@@ -580,19 +557,6 @@ definitions:
required:
- type
type: object
dto.CommonConfig:
properties:
action:
type: string
code:
type: integer
res:
type: string
state:
type: string
type:
type: string
type: object
dto.CommonRecover:
properties:
detailName:
@@ -1740,21 +1704,6 @@ definitions:
required:
- encryptionMode
type: object
dto.GeoRestrict:
properties:
action:
type: string
res:
type: string
rules:
items:
type: string
type: array
state:
type: string
type:
type: string
type: object
dto.GroupCreate:
properties:
id:
@@ -2497,6 +2446,24 @@ definitions:
- CACHE
- HttpPer
- ProxyCache
dto.OllamaBindDomain:
properties:
allowIPs:
items:
type: string
type: array
appInstallID:
type: integer
domain:
type: string
sslID:
type: integer
websiteID:
type: integer
required:
- appInstallID
- domain
type: object
dto.OllamaBindDomainReq:
properties:
appInstallID:
@@ -3512,11 +3479,6 @@ definitions:
upload:
type: string
type: object
dto.StateConfig:
properties:
state:
type: string
type: object
dto.SwapHelper:
properties:
isNew:
@@ -3646,50 +3608,6 @@ definitions:
type:
type: string
type: object
dto.WafConfig:
properties:
mode:
type: string
secret:
type: string
state:
type: string
token:
type: string
required:
- mode
- secret
- state
type: object
dto.WebsiteConfig:
properties:
args:
$ref: '#/definitions/dto.CommonConfig'
cc:
$ref: '#/definitions/dto.CCConfig'
cdn:
$ref: '#/definitions/dto.StateConfig'
cookie:
$ref: '#/definitions/dto.CommonConfig'
defaultUaBlack:
$ref: '#/definitions/dto.CommonConfig'
defaultUrlBlack:
$ref: '#/definitions/dto.CommonConfig'
fileExt:
$ref: '#/definitions/dto.CommonConfig'
geoRestrict:
$ref: '#/definitions/dto.GeoRestrict'
header:
$ref: '#/definitions/dto.CommonConfig'
methodWhite:
$ref: '#/definitions/dto.CommonConfig'
sql:
$ref: '#/definitions/dto.CommonConfig'
waf:
$ref: '#/definitions/dto.WafConfig'
xss:
$ref: '#/definitions/dto.CommonConfig'
type: object
dto.XPUInfo:
properties:
deviceID:
@@ -6569,7 +6487,7 @@ info:
title: 1Panel
version: "1.0"
paths:
/aitool/domain/bind:
/ai/domain/bind:
post:
consumes:
- application/json
@@ -6579,7 +6497,7 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/dto.WebsiteConfig'
$ref: '#/definitions/dto.OllamaBindDomain'
responses:
"200":
description: OK
@@ -6588,8 +6506,8 @@ paths:
- Timestamp: []
summary: Bind domain
tags:
- AITools
/aitool/domain/get:
- AI
/ai/domain/get:
post:
consumes:
- application/json
@@ -6610,8 +6528,8 @@ paths:
- Timestamp: []
summary: Get bind domain
tags:
- AITools
/aitool/gpu/load:
- AI
/ai/gpu/load:
get:
consumes:
- application/json
@@ -6623,35 +6541,8 @@ paths:
- Timestamp: []
summary: Load gpu / xpu info
tags:
- AITools
/aitool/ollama/model/del:
post:
consumes:
- application/json
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OllamaModelName'
responses:
"200":
description: OK
security:
- ApiKeyAuth: []
- Timestamp: []
summary: Delete Ollama model
tags:
- AITools
x-panel-log:
BeforeFunctions: []
bodyKeys:
- name
formatEN: remove Ollama model [name]
formatZH: 删除模型 [name]
paramKeys: []
/aitools/ollama/model:
- AI
/ai/ollama/model:
post:
consumes:
- application/json
@@ -6670,7 +6561,7 @@ paths:
- Timestamp: []
summary: Create Ollama model
tags:
- AITools
- AI
x-panel-log:
BeforeFunctions: []
bodyKeys:
@@ -6678,7 +6569,34 @@ paths:
formatEN: add Ollama model [name]
formatZH: 添加模型 [name]
paramKeys: []
/aitools/ollama/model/load:
/ai/ollama/model/del:
post:
consumes:
- application/json
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OllamaModelName'
responses:
"200":
description: OK
security:
- ApiKeyAuth: []
- Timestamp: []
summary: Delete Ollama model
tags:
- AI
x-panel-log:
BeforeFunctions: []
bodyKeys:
- name
formatEN: remove Ollama model [name]
formatZH: 删除模型 [name]
paramKeys: []
/ai/ollama/model/load:
post:
consumes:
- application/json
@@ -6699,8 +6617,8 @@ paths:
- Timestamp: []
summary: Page Ollama models
tags:
- AITools
/aitools/ollama/model/search:
- AI
/ai/ollama/model/search:
post:
consumes:
- application/json
@@ -6721,7 +6639,7 @@ paths:
- Timestamp: []
summary: Page Ollama models
tags:
- AITools
- AI
/apps/{key}:
get:
consumes: