docs(api): 更新Swagger文档以包含助理工具类型
更新了Swagger API文档,以包含新的“assistant_tool_type”定义。这定义了助理工具类型,包括ID、助理和工具的ID、创建和更新时间等属性。此外,调整了若干API路径的响应和参数部分,以更准确地反映当前的API行为。
This commit is contained in:
parent
1a70561f7c
commit
4bdb33ba19
625
api/swagger.yaml
625
api/swagger.yaml
@ -29,6 +29,23 @@ definitions:
|
|||||||
updated_at:
|
updated_at:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
rag-new_internal_entity.AssistantToolType:
|
||||||
|
properties:
|
||||||
|
assistant:
|
||||||
|
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||||
|
assistant_id:
|
||||||
|
type: integer
|
||||||
|
created_at:
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
tool:
|
||||||
|
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||||
|
tool_id:
|
||||||
|
type: integer
|
||||||
|
updated_at:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
rag-new_internal_entity.Chat:
|
rag-new_internal_entity.Chat:
|
||||||
properties:
|
properties:
|
||||||
assistant_id:
|
assistant_id:
|
||||||
@ -72,7 +89,7 @@ definitions:
|
|||||||
created_at:
|
created_at:
|
||||||
type: string
|
type: string
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutput"
|
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutput'
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
discovery_url:
|
discovery_url:
|
||||||
@ -97,8 +114,8 @@ definitions:
|
|||||||
prompt:
|
prompt:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- description
|
- description
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
rag-new_internal_schema.ChatCreateRequest:
|
rag-new_internal_schema.ChatCreateRequest:
|
||||||
properties:
|
properties:
|
||||||
@ -108,8 +125,8 @@ definitions:
|
|||||||
maxLength: 255
|
maxLength: 255
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- assistant_id
|
- assistant_id
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
rag-new_internal_schema.ChatMessageAddRequest:
|
rag-new_internal_schema.ChatMessageAddRequest:
|
||||||
properties:
|
properties:
|
||||||
@ -117,7 +134,7 @@ definitions:
|
|||||||
maxLength: 255
|
maxLength: 255
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- message
|
- message
|
||||||
type: object
|
type: object
|
||||||
rag-new_internal_schema.ChatMessageResponse:
|
rag-new_internal_schema.ChatMessageResponse:
|
||||||
properties:
|
properties:
|
||||||
@ -160,9 +177,9 @@ definitions:
|
|||||||
maxLength: 255
|
maxLength: 255
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- description
|
- description
|
||||||
- name
|
- name
|
||||||
- url
|
- url
|
||||||
type: object
|
type: object
|
||||||
rag-new_internal_schema.ToolDiscoveryOutput:
|
rag-new_internal_schema.ToolDiscoveryOutput:
|
||||||
properties:
|
properties:
|
||||||
@ -172,7 +189,7 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
function:
|
function:
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunctions"
|
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunctions'
|
||||||
type: array
|
type: array
|
||||||
homepage_url:
|
homepage_url:
|
||||||
type: string
|
type: string
|
||||||
@ -195,7 +212,7 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
function:
|
function:
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunction"
|
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunction'
|
||||||
type: array
|
type: array
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
@ -208,594 +225,618 @@ paths:
|
|||||||
/api/v1/assistants:
|
/api/v1/assistants:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 获取 Assistant 列表
|
summary: 获取 Assistant 列表
|
||||||
tags:
|
tags:
|
||||||
- assistant
|
- assistant
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
|
||||||
parameters:
|
parameters:
|
||||||
- description: Assistant
|
- description: Assistant
|
||||||
in: body
|
in: body
|
||||||
name: assistant
|
name: assistant
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.AssistantCreateRequest"
|
$ref: '#/definitions/rag-new_internal_schema.AssistantCreateRequest'
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 创建 Assistant
|
summary: 创建 Assistant
|
||||||
tags:
|
tags:
|
||||||
- assistant
|
- assistant
|
||||||
/api/v1/assistants/{id}:
|
/api/v1/assistants/{id}:
|
||||||
delete:
|
delete:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
|
||||||
parameters:
|
parameters:
|
||||||
- description: Assistant ID
|
- description: Assistant ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"204":
|
"204":
|
||||||
description: No Content
|
description: No Content
|
||||||
"404":
|
"404":
|
||||||
description: Not Found
|
description: Not Found
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 删除 Assistant
|
summary: 删除 Assistant
|
||||||
tags:
|
tags:
|
||||||
- assistant
|
- assistant
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- description: Assistant ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||||
|
type: object
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 获取指定的 Assistant
|
||||||
|
tags:
|
||||||
|
- assistant
|
||||||
/api/v1/assistants/{id}/tools:
|
/api/v1/assistants/{id}/tools:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
|
||||||
parameters:
|
parameters:
|
||||||
- description: Assistant ID
|
- description: Assistant ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.AssistantTool"
|
$ref: '#/definitions/rag-new_internal_entity.AssistantToolType'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 获取 Assistant 所绑定的 Tool
|
summary: 获取 Assistant 所绑定的 Tool
|
||||||
tags:
|
tags:
|
||||||
- assistant
|
- assistant
|
||||||
/api/v1/assistants/{id}/tools/{tool_id}:
|
/api/v1/assistants/{id}/tools/{tool_id}:
|
||||||
delete:
|
delete:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
|
||||||
parameters:
|
parameters:
|
||||||
- description: Assistant ID
|
- description: Assistant ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
- description: Tool ID
|
- description: Tool ID
|
||||||
in: path
|
in: path
|
||||||
name: tool_id
|
name: tool_id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.AssistantTool"
|
$ref: '#/definitions/rag-new_internal_entity.AssistantTool'
|
||||||
type: object
|
type: object
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 解绑 Tool
|
summary: 解绑 Tool
|
||||||
tags:
|
tags:
|
||||||
- assistant
|
- assistant
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
|
||||||
parameters:
|
parameters:
|
||||||
- description: Assistant ID
|
- description: Assistant ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
- description: Tool ID
|
- description: Tool ID
|
||||||
in: path
|
in: path
|
||||||
name: tool_id
|
name: tool_id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.AssistantTool"
|
$ref: '#/definitions/rag-new_internal_entity.AssistantTool'
|
||||||
type: object
|
type: object
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 绑定 Tool
|
summary: 绑定 Tool
|
||||||
tags:
|
tags:
|
||||||
- assistant
|
- assistant
|
||||||
/api/v1/chats:
|
/api/v1/chats:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
description: get string by ID
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.Chat"
|
$ref: '#/definitions/rag-new_internal_entity.Chat'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
summary: 获取所有 Chat
|
summary: 获取所有 Chat
|
||||||
tags:
|
tags:
|
||||||
- chat
|
- chat
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
description: get string by ID
|
||||||
parameters:
|
parameters:
|
||||||
- description: Chat
|
- description: Chat
|
||||||
in: body
|
in: body
|
||||||
name: chat
|
name: chat
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ChatCreateRequest"
|
$ref: '#/definitions/rag-new_internal_schema.ChatCreateRequest'
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.Chat"
|
$ref: '#/definitions/rag-new_internal_entity.Chat'
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
summary: Create Chat
|
summary: Create Chat
|
||||||
tags:
|
tags:
|
||||||
- chat
|
- chat
|
||||||
/api/v1/chats/{id}:
|
/api/v1/chats/{id}:
|
||||||
delete:
|
delete:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
description: get string by ID
|
||||||
parameters:
|
parameters:
|
||||||
- description: Chat ID
|
- description: Chat ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"404":
|
"404":
|
||||||
description: Not Found
|
description: Not Found
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Delete Chat
|
summary: Delete Chat
|
||||||
tags:
|
tags:
|
||||||
- chat
|
- chat
|
||||||
/api/v1/chats/{id}/messages:
|
/api/v1/chats/{id}/messages:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
description: get string by ID
|
||||||
parameters:
|
parameters:
|
||||||
- description: Chat ID
|
- description: Chat ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.ChatMessage"
|
$ref: '#/definitions/rag-new_internal_entity.ChatMessage'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"404":
|
"404":
|
||||||
description: Not Found
|
description: Not Found
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 查看聊天记录
|
summary: 查看聊天记录
|
||||||
tags:
|
tags:
|
||||||
- chat_message
|
- chat_message
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
description: get string by ID
|
||||||
parameters:
|
parameters:
|
||||||
- description: Chat ID
|
- description: Chat ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
- description: Message
|
- description: Message
|
||||||
in: body
|
in: body
|
||||||
name: message
|
name: message
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageAddRequest"
|
$ref: '#/definitions/rag-new_internal_schema.ChatMessageAddRequest'
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"404":
|
"404":
|
||||||
description: Not Found
|
description: Not Found
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"409":
|
"409":
|
||||||
description: Conflict
|
description: Conflict
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||||
type: object
|
type: object
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: 添加聊天记录
|
summary: 添加聊天记录
|
||||||
tags:
|
tags:
|
||||||
- chat_message
|
- chat_message
|
||||||
/api/v1/ping:
|
/api/v1/ping:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
description: get string by ID
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.CurrentUserResponse"
|
$ref: '#/definitions/rag-new_internal_schema.CurrentUserResponse'
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Greet
|
summary: Greet
|
||||||
tags:
|
tags:
|
||||||
- ping
|
- ping
|
||||||
/api/v1/stream/{stream_id}:
|
/api/v1/stream/{stream_id}:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: get string by ID
|
description: get string by ID
|
||||||
parameters:
|
parameters:
|
||||||
- description: Chat ID
|
- description: Chat ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
- description: Chat stream id
|
- description: Chat stream id
|
||||||
in: path
|
in: path
|
||||||
name: stream_id
|
name: stream_id
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"404":
|
"404":
|
||||||
description: Not Found
|
description: Not Found
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"409":
|
"409":
|
||||||
description: Conflict
|
description: Conflict
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||||
type: object
|
type: object
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- none: []
|
- none: []
|
||||||
summary: 流式传输聊天内容
|
summary: 流式传输聊天内容
|
||||||
tags:
|
tags:
|
||||||
- chat_message
|
- chat_message
|
||||||
/api/v1/tools:
|
/api/v1/tools:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: List tools
|
description: List tools
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.CurrentUserResponse"
|
items:
|
||||||
type: object
|
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: List Tool
|
summary: List Tool
|
||||||
tags:
|
tags:
|
||||||
- tool
|
- tool
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: Create tool
|
description: Create tool
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tool
|
- description: Tool
|
||||||
in: body
|
in: body
|
||||||
name: tool
|
name: tool
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ToolCreateRequest"
|
$ref: '#/definitions/rag-new_internal_schema.ToolCreateRequest'
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
items:
|
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
type: object
|
||||||
type: array
|
|
||||||
type: object
|
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Create Tool
|
summary: Create Tool
|
||||||
tags:
|
tags:
|
||||||
- tool
|
- tool
|
||||||
/api/v1/tools/{id}:
|
/api/v1/tools/{id}:
|
||||||
delete:
|
delete:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: DeleteTool
|
description: DeleteTool
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tool ID
|
- description: Tool ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"404":
|
"404":
|
||||||
description: Not Found
|
description: Not Found
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: DeleteTool
|
summary: DeleteTool
|
||||||
tags:
|
tags:
|
||||||
- tool
|
- tool
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: Get tool
|
description: Get tool
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tool ID
|
- description: Tool ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: integer
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
"404":
|
"404":
|
||||||
description: Not Found
|
description: Not Found
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Get Tool
|
summary: Get Tool
|
||||||
tags:
|
tags:
|
||||||
- tool
|
- tool
|
||||||
securityDefinitions:
|
securityDefinitions:
|
||||||
ApiKeyAuth:
|
ApiKeyAuth:
|
||||||
in: header
|
in: header
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Welcome to Vuetify 3</title>
|
<title>Leaflow Amber</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
4669
src/api/api.ts
4669
src/api/api.ts
File diff suppressed because it is too large
Load Diff
@ -5,18 +5,19 @@
|
|||||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 1.0
|
* The version of the OpenAPI document: 1.0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Configuration } from "./configuration";
|
|
||||||
|
import type { Configuration } from './configuration';
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from "axios";
|
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
||||||
import globalAxios from "axios";
|
import globalAxios from 'axios';
|
||||||
|
|
||||||
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
||||||
|
|
||||||
@ -25,10 +26,10 @@ export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const COLLECTION_FORMATS = {
|
export const COLLECTION_FORMATS = {
|
||||||
csv: ",",
|
csv: ",",
|
||||||
ssv: " ",
|
ssv: " ",
|
||||||
tsv: "\t",
|
tsv: "\t",
|
||||||
pipes: "|",
|
pipes: "|",
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,8 +38,8 @@ export const COLLECTION_FORMATS = {
|
|||||||
* @interface RequestArgs
|
* @interface RequestArgs
|
||||||
*/
|
*/
|
||||||
export interface RequestArgs {
|
export interface RequestArgs {
|
||||||
url: string;
|
url: string;
|
||||||
options: RawAxiosRequestConfig;
|
options: RawAxiosRequestConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,19 +48,15 @@ export interface RequestArgs {
|
|||||||
* @class BaseAPI
|
* @class BaseAPI
|
||||||
*/
|
*/
|
||||||
export class BaseAPI {
|
export class BaseAPI {
|
||||||
protected configuration: Configuration | undefined;
|
protected configuration: Configuration | undefined;
|
||||||
|
|
||||||
constructor(
|
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||||
configuration?: Configuration,
|
if (configuration) {
|
||||||
protected basePath: string = BASE_PATH,
|
this.configuration = configuration;
|
||||||
protected axios: AxiosInstance = globalAxios,
|
this.basePath = configuration.basePath ?? basePath;
|
||||||
) {
|
}
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
this.basePath = configuration.basePath ?? basePath;
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -68,24 +65,22 @@ export class BaseAPI {
|
|||||||
* @extends {Error}
|
* @extends {Error}
|
||||||
*/
|
*/
|
||||||
export class RequiredError extends Error {
|
export class RequiredError extends Error {
|
||||||
constructor(
|
constructor(public field: string, msg?: string) {
|
||||||
public field: string,
|
super(msg);
|
||||||
msg?: string,
|
this.name = "RequiredError"
|
||||||
) {
|
}
|
||||||
super(msg);
|
|
||||||
this.name = "RequiredError";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ServerMap {
|
interface ServerMap {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
url: string;
|
url: string,
|
||||||
description: string;
|
description: string,
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const operationServerMap: ServerMap = {};
|
export const operationServerMap: ServerMap = {
|
||||||
|
}
|
||||||
|
@ -5,139 +5,105 @@
|
|||||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 1.0
|
* The version of the OpenAPI document: 1.0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import type { Configuration } from "./configuration";
|
import type { Configuration } from "./configuration";
|
||||||
import type { RequestArgs } from "./base";
|
import type { RequestArgs } from "./base";
|
||||||
import type { AxiosInstance, AxiosResponse } from "axios";
|
import type { AxiosInstance, AxiosResponse } from 'axios';
|
||||||
import { RequiredError } from "./base";
|
import { RequiredError } from "./base";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const DUMMY_BASE_URL = "https://example.com";
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const assertParamExists = function (
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
functionName: string,
|
if (paramValue === null || paramValue === undefined) {
|
||||||
paramName: string,
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
paramValue: unknown,
|
|
||||||
) {
|
|
||||||
if (paramValue === null || paramValue === undefined) {
|
|
||||||
throw new RequiredError(
|
|
||||||
paramName,
|
|
||||||
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setApiKeyToObject = async function (
|
|
||||||
object: any,
|
|
||||||
keyParamName: string,
|
|
||||||
configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
if (configuration && configuration.apiKey) {
|
|
||||||
const localVarApiKeyValue =
|
|
||||||
typeof configuration.apiKey === "function"
|
|
||||||
? await configuration.apiKey(keyParamName)
|
|
||||||
: await configuration.apiKey;
|
|
||||||
object[keyParamName] = localVarApiKeyValue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBasicAuthToObject = function (
|
|
||||||
object: any,
|
|
||||||
configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
if (configuration && (configuration.username || configuration.password)) {
|
|
||||||
object["auth"] = {
|
|
||||||
username: configuration.username,
|
|
||||||
password: configuration.password,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBearerAuthToObject = async function (
|
|
||||||
object: any,
|
|
||||||
configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const accessToken =
|
|
||||||
typeof configuration.accessToken === "function"
|
|
||||||
? await configuration.accessToken()
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + accessToken;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setOAuthToObject = async function (
|
|
||||||
object: any,
|
|
||||||
name: string,
|
|
||||||
scopes: string[],
|
|
||||||
configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const localVarAccessTokenValue =
|
|
||||||
typeof configuration.accessToken === "function"
|
|
||||||
? await configuration.accessToken(name, scopes)
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function setFlattenedQueryParams(
|
|
||||||
urlSearchParams: URLSearchParams,
|
|
||||||
parameter: any,
|
|
||||||
key: string = "",
|
|
||||||
): void {
|
|
||||||
if (parameter == null) return;
|
|
||||||
if (typeof parameter === "object") {
|
|
||||||
if (Array.isArray(parameter)) {
|
|
||||||
(parameter as any[]).forEach((item) =>
|
|
||||||
setFlattenedQueryParams(urlSearchParams, item, key),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
Object.keys(parameter).forEach((currentKey) =>
|
|
||||||
setFlattenedQueryParams(
|
|
||||||
urlSearchParams,
|
|
||||||
parameter[currentKey],
|
|
||||||
`${key}${key !== "" ? "." : ""}${currentKey}`,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (urlSearchParams.has(key)) {
|
|
||||||
urlSearchParams.append(key, parameter);
|
/**
|
||||||
} else {
|
*
|
||||||
urlSearchParams.set(key, parameter);
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
||||||
|
if (parameter == null) return;
|
||||||
|
if (typeof parameter === "object") {
|
||||||
|
if (Array.isArray(parameter)) {
|
||||||
|
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Object.keys(parameter).forEach(currentKey =>
|
||||||
|
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (urlSearchParams.has(key)) {
|
||||||
|
urlSearchParams.append(key, parameter);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
urlSearchParams.set(key, parameter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,58 +111,40 @@ function setFlattenedQueryParams(
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
const searchParams = new URLSearchParams(url.search);
|
const searchParams = new URLSearchParams(url.search);
|
||||||
setFlattenedQueryParams(searchParams, objects);
|
setFlattenedQueryParams(searchParams, objects);
|
||||||
url.search = searchParams.toString();
|
url.search = searchParams.toString();
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const serializeDataIfNeeded = function (
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
value: any,
|
const nonString = typeof value !== 'string';
|
||||||
requestOptions: any,
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
configuration?: Configuration,
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
) {
|
: nonString;
|
||||||
const nonString = typeof value !== "string";
|
return needsSerialization
|
||||||
const needsSerialization =
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
nonString && configuration && configuration.isJsonMime
|
: (value || "");
|
||||||
? configuration.isJsonMime(requestOptions.headers["Content-Type"])
|
}
|
||||||
: nonString;
|
|
||||||
return needsSerialization
|
|
||||||
? JSON.stringify(value !== undefined ? value : {})
|
|
||||||
: value || "";
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const toPathString = function (url: URL) {
|
export const toPathString = function (url: URL) {
|
||||||
return url.pathname + url.search + url.hash;
|
return url.pathname + url.search + url.hash
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const createRequestFunction = function (
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
axiosArgs: RequestArgs,
|
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
globalAxios: AxiosInstance,
|
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
|
||||||
BASE_PATH: string,
|
return axios.request<T, R>(axiosRequestArgs);
|
||||||
configuration?: Configuration,
|
|
||||||
) {
|
|
||||||
return <T = unknown, R = AxiosResponse<T>>(
|
|
||||||
axios: AxiosInstance = globalAxios,
|
|
||||||
basePath: string = BASE_PATH,
|
|
||||||
) => {
|
|
||||||
const axiosRequestArgs = {
|
|
||||||
...axiosArgs.options,
|
|
||||||
url:
|
|
||||||
(axios.defaults.baseURL ? "" : (configuration?.basePath ?? basePath)) +
|
|
||||||
axiosArgs.url,
|
|
||||||
};
|
};
|
||||||
return axios.request<T, R>(axiosRequestArgs);
|
}
|
||||||
};
|
|
||||||
};
|
|
||||||
|
@ -5,128 +5,106 @@
|
|||||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 1.0
|
* The version of the OpenAPI document: 1.0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
apiKey?:
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||||
| string
|
username?: string;
|
||||||
| Promise<string>
|
password?: string;
|
||||||
| ((name: string) => string)
|
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||||
| ((name: string) => Promise<string>);
|
basePath?: string;
|
||||||
username?: string;
|
serverIndex?: number;
|
||||||
password?: string;
|
baseOptions?: any;
|
||||||
accessToken?:
|
formDataCtor?: new () => any;
|
||||||
| string
|
|
||||||
| Promise<string>
|
|
||||||
| ((name?: string, scopes?: string[]) => string)
|
|
||||||
| ((name?: string, scopes?: string[]) => Promise<string>);
|
|
||||||
basePath?: string;
|
|
||||||
serverIndex?: number;
|
|
||||||
baseOptions?: any;
|
|
||||||
formDataCtor?: new () => any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Configuration {
|
export class Configuration {
|
||||||
/**
|
/**
|
||||||
* parameter for apiKey security
|
* parameter for apiKey security
|
||||||
* @param name security name
|
* @param name security name
|
||||||
* @memberof Configuration
|
* @memberof Configuration
|
||||||
*/
|
*/
|
||||||
apiKey?:
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||||
| string
|
/**
|
||||||
| Promise<string>
|
* parameter for basic security
|
||||||
| ((name: string) => string)
|
*
|
||||||
| ((name: string) => Promise<string>);
|
* @type {string}
|
||||||
/**
|
* @memberof Configuration
|
||||||
* parameter for basic security
|
*/
|
||||||
*
|
username?: string;
|
||||||
* @type {string}
|
/**
|
||||||
* @memberof Configuration
|
* parameter for basic security
|
||||||
*/
|
*
|
||||||
username?: string;
|
* @type {string}
|
||||||
/**
|
* @memberof Configuration
|
||||||
* parameter for basic security
|
*/
|
||||||
*
|
password?: string;
|
||||||
* @type {string}
|
/**
|
||||||
* @memberof Configuration
|
* parameter for oauth2 security
|
||||||
*/
|
* @param name security name
|
||||||
password?: string;
|
* @param scopes oauth2 scope
|
||||||
/**
|
* @memberof Configuration
|
||||||
* parameter for oauth2 security
|
*/
|
||||||
* @param name security name
|
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||||
* @param scopes oauth2 scope
|
/**
|
||||||
* @memberof Configuration
|
* override base path
|
||||||
*/
|
*
|
||||||
accessToken?:
|
* @type {string}
|
||||||
| string
|
* @memberof Configuration
|
||||||
| Promise<string>
|
*/
|
||||||
| ((name?: string, scopes?: string[]) => string)
|
basePath?: string;
|
||||||
| ((name?: string, scopes?: string[]) => Promise<string>);
|
/**
|
||||||
/**
|
* override server index
|
||||||
* override base path
|
*
|
||||||
*
|
* @type {number}
|
||||||
* @type {string}
|
* @memberof Configuration
|
||||||
* @memberof Configuration
|
*/
|
||||||
*/
|
serverIndex?: number;
|
||||||
basePath?: string;
|
/**
|
||||||
/**
|
* base options for axios calls
|
||||||
* override server index
|
*
|
||||||
*
|
* @type {any}
|
||||||
* @type {number}
|
* @memberof Configuration
|
||||||
* @memberof Configuration
|
*/
|
||||||
*/
|
baseOptions?: any;
|
||||||
serverIndex?: number;
|
/**
|
||||||
/**
|
* The FormData constructor that will be used to create multipart form data
|
||||||
* base options for axios calls
|
* requests. You can inject this here so that execution environments that
|
||||||
*
|
* do not support the FormData class can still run the generated client.
|
||||||
* @type {any}
|
*
|
||||||
* @memberof Configuration
|
* @type {new () => FormData}
|
||||||
*/
|
*/
|
||||||
baseOptions?: any;
|
formDataCtor?: new () => any;
|
||||||
/**
|
|
||||||
* The FormData constructor that will be used to create multipart form data
|
|
||||||
* requests. You can inject this here so that execution environments that
|
|
||||||
* do not support the FormData class can still run the generated client.
|
|
||||||
*
|
|
||||||
* @type {new () => FormData}
|
|
||||||
*/
|
|
||||||
formDataCtor?: new () => any;
|
|
||||||
|
|
||||||
constructor(param: ConfigurationParameters = {}) {
|
constructor(param: ConfigurationParameters = {}) {
|
||||||
this.apiKey = param.apiKey;
|
this.apiKey = param.apiKey;
|
||||||
this.username = param.username;
|
this.username = param.username;
|
||||||
this.password = param.password;
|
this.password = param.password;
|
||||||
this.accessToken = param.accessToken;
|
this.accessToken = param.accessToken;
|
||||||
this.basePath = param.basePath;
|
this.basePath = param.basePath;
|
||||||
this.serverIndex = param.serverIndex;
|
this.serverIndex = param.serverIndex;
|
||||||
this.baseOptions = param.baseOptions;
|
this.baseOptions = param.baseOptions;
|
||||||
this.formDataCtor = param.formDataCtor;
|
this.formDataCtor = param.formDataCtor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given MIME is a JSON MIME.
|
* Check if the given MIME is a JSON MIME.
|
||||||
* JSON MIME examples:
|
* JSON MIME examples:
|
||||||
* application/json
|
* application/json
|
||||||
* application/json; charset=UTF8
|
* application/json; charset=UTF8
|
||||||
* APPLICATION/JSON
|
* APPLICATION/JSON
|
||||||
* application/vnd.company+json
|
* application/vnd.company+json
|
||||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||||
* @return True if the given MIME is JSON, false otherwise.
|
* @return True if the given MIME is JSON, false otherwise.
|
||||||
*/
|
*/
|
||||||
public isJsonMime(mime: string): boolean {
|
public isJsonMime(mime: string): boolean {
|
||||||
const jsonMime: RegExp = new RegExp(
|
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||||
"^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$",
|
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||||
"i",
|
}
|
||||||
);
|
|
||||||
return (
|
|
||||||
mime !== null &&
|
|
||||||
(jsonMime.test(mime) ||
|
|
||||||
mime.toLowerCase() === "application/json-patch+json")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,14 @@
|
|||||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 1.0
|
* The version of the OpenAPI document: 1.0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export * from "./api";
|
export * from "./api";
|
||||||
export * from "./configuration";
|
export * from "./configuration";
|
||||||
|
|
||||||
|
@ -25,6 +25,13 @@
|
|||||||
to="/assistants"
|
to="/assistants"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<v-list-item
|
||||||
|
prepend-icon="mdi-home"
|
||||||
|
rounded="lg"
|
||||||
|
title="工具"
|
||||||
|
to="/tools"
|
||||||
|
/>
|
||||||
|
|
||||||
<v-list-item
|
<v-list-item
|
||||||
prepend-icon="mdi-home"
|
prepend-icon="mdi-home"
|
||||||
rounded="lg"
|
rounded="lg"
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
# Components
|
|
||||||
|
|
||||||
Vue template files in this folder are automatically imported.
|
|
||||||
|
|
||||||
## 🚀 Usage
|
|
||||||
|
|
||||||
Importing is handled by [unplugin-vue-components](https://github.com/unplugin/unplugin-vue-components). This plugin automatically imports `.vue` files created in the `src/components` directory, and registers them as global components. This means that you can use any component in your application without having to manually import it.
|
|
||||||
|
|
||||||
The following example assumes a component located at `src/components/MyComponent.vue`:
|
|
||||||
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<MyComponent />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
//
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
When your template is rendered, the component's import will automatically be inlined, which renders to this:
|
|
||||||
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<MyComponent />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import MyComponent from "@/components/MyComponent.vue";
|
|
||||||
</script>
|
|
||||||
```
|
|
112
src/pages/assistants/[id]/tools.vue
Normal file
112
src/pages/assistants/[id]/tools.vue
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<h3>助理 {{ assistant.data?.name }}</h3>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<p>已经绑定的工具</p>
|
||||||
|
<v-row>
|
||||||
|
<v-col
|
||||||
|
v-for="tool in bindedTools.data"
|
||||||
|
:key="tool.id"
|
||||||
|
cols="12"
|
||||||
|
md="4"
|
||||||
|
sm="6"
|
||||||
|
>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>{{ tool.tool?.name }}</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<p>函数名称: {{ tool.tool?.data?.name }}</p>
|
||||||
|
<p>函数描述:{{ tool.tool?.data?.description }}</p>
|
||||||
|
<p>主页地址: {{ tool.tool?.data?.homepage_url }}</p>
|
||||||
|
</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-btn color="error" @click="unbindTool(tool.tool_id ?? 0)"
|
||||||
|
>解除绑定</v-btn
|
||||||
|
>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4">
|
||||||
|
<p>你创建的工具</p>
|
||||||
|
<v-row>
|
||||||
|
<v-col v-for="tool in tools.data" :key="tool.id" cols="12" md="4" sm="6">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>{{ tool.name }}</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<p>函数名称: {{ tool.data?.name }}</p>
|
||||||
|
<p>函数描述:{{ tool.data?.description }}</p>
|
||||||
|
<p>主页地址: {{ tool.data?.homepage_url }}</p>
|
||||||
|
</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-btn color="primary" @click="bindTool(tool.id ?? 0)">绑定</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { api } from "@/plugins/api";
|
||||||
|
import router from "@/router";
|
||||||
|
import {
|
||||||
|
ApiV1AssistantsIdToolsGet200Response,
|
||||||
|
ApiV1AssistantsPost200Response,
|
||||||
|
ApiV1ToolsGet200Response,
|
||||||
|
} from "@/api";
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const assistantId = router.currentRoute.value.params.id as number;
|
||||||
|
const assistant: Ref<ApiV1AssistantsPost200Response> = ref({});
|
||||||
|
const tools: Ref<ApiV1ToolsGet200Response> = ref({});
|
||||||
|
|
||||||
|
const bindedTools: Ref<ApiV1AssistantsIdToolsGet200Response> = ref({});
|
||||||
|
|
||||||
|
function getAssistant() {
|
||||||
|
api.Assistant.apiV1AssistantsIdGet(assistantId).then((res) => {
|
||||||
|
assistant.value = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBindedTools() {
|
||||||
|
api.Assistant.apiV1AssistantsIdToolsGet(assistantId).then((res) => {
|
||||||
|
bindedTools.value = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTools() {
|
||||||
|
api.Tool.apiV1ToolsGet().then((res) => {
|
||||||
|
tools.value = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function unbindTool(toolId: number) {
|
||||||
|
api.Assistant.apiV1AssistantsIdToolsToolIdDelete(assistantId, toolId)
|
||||||
|
.then(() => {
|
||||||
|
refresh();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
getAssistant();
|
||||||
|
getTools();
|
||||||
|
getBindedTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindTool(toolId: number) {
|
||||||
|
api.Assistant.apiV1AssistantsIdToolsToolIdPost(assistantId, toolId)
|
||||||
|
.then(() => {
|
||||||
|
refresh();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
</script>
|
0
src/pages/assistants/binds.vue
Normal file
0
src/pages/assistants/binds.vue
Normal file
@ -20,12 +20,13 @@
|
|||||||
<p>Phone: {{ assistant.phone }}</p> -->
|
<p>Phone: {{ assistant.phone }}</p> -->
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn color="primary" @click="openDialog(assistant.id ?? 0)"
|
<!-- <v-btn color="primary" @click="openDialog(assistant.id ?? 0)"
|
||||||
>对话</v-btn
|
>对话</v-btn
|
||||||
|
> -->
|
||||||
|
|
||||||
|
<v-btn color="primary" @click="editTool(assistant.id ?? 0)"
|
||||||
|
>工具</v-btn
|
||||||
>
|
>
|
||||||
<!-- <v-btn color="primary" @click="editAssistant(assistant)"
|
|
||||||
>编辑</v-btn
|
|
||||||
> -->
|
|
||||||
<v-btn color="error" @click="deleteAssistant(assistant.id ?? 0)"
|
<v-btn color="error" @click="deleteAssistant(assistant.id ?? 0)"
|
||||||
>删除</v-btn
|
>删除</v-btn
|
||||||
>
|
>
|
||||||
@ -61,7 +62,6 @@ const assistants: Ref<ApiV1AssistantsGet200Response> = ref({});
|
|||||||
function refresh() {
|
function refresh() {
|
||||||
api.Assistant.apiV1AssistantsGet().then((res) => {
|
api.Assistant.apiV1AssistantsGet().then((res) => {
|
||||||
assistants.value = res.data;
|
assistants.value = res.data;
|
||||||
console.log(assistants.value);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
@ -87,6 +87,10 @@ function deleteAssistantConfirmed() {
|
|||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editTool(assistantId: number) {
|
||||||
|
router.push(`/assistants/${assistantId}/tools`);
|
||||||
|
}
|
||||||
|
|
||||||
function to(path: string) {
|
function to(path: string) {
|
||||||
router.push(path);
|
router.push(path);
|
||||||
}
|
}
|
||||||
|
58
src/pages/tools/create.vue
Normal file
58
src/pages/tools/create.vue
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h3>创建工具</h3>
|
||||||
|
<v-text-field v-model="toolName" label="工具名称" required></v-text-field>
|
||||||
|
<v-textarea
|
||||||
|
v-model="toolDescription"
|
||||||
|
label="工具描述"
|
||||||
|
required
|
||||||
|
></v-textarea>
|
||||||
|
<v-text-field v-model="toolUrl" label="发现地址" required></v-text-field>
|
||||||
|
<v-text-field v-model="toolApiKey" label="认证密钥" required></v-text-field>
|
||||||
|
<v-btn color="primary" @click="createTool">创建</v-btn>
|
||||||
|
<v-dialog v-model="failedDialog.show" max-width="290" persistent>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title class="headline">创建失败</v-card-title>
|
||||||
|
<v-card-text>{{ failedDialog.message }}</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn color="green darken-1" @click="failedDialog.show = false"
|
||||||
|
>关闭</v-btn
|
||||||
|
>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { api } from "@/plugins/api";
|
||||||
|
import router from "@/router";
|
||||||
|
|
||||||
|
const toolName = ref("");
|
||||||
|
const toolDescription = ref("");
|
||||||
|
const toolUrl = ref("");
|
||||||
|
const toolApiKey = ref("");
|
||||||
|
|
||||||
|
function createTool() {
|
||||||
|
api.Tool.apiV1ToolsPost({
|
||||||
|
name: toolName.value,
|
||||||
|
description: toolDescription.value,
|
||||||
|
url: toolUrl.value,
|
||||||
|
api_key: toolApiKey.value,
|
||||||
|
})
|
||||||
|
.then((r) => {
|
||||||
|
router.push("/tools");
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
failedDialog.value.show = true;
|
||||||
|
failedDialog.value.message = e.response?.data?.error ?? "未知错误";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const failedDialog = ref({
|
||||||
|
show: false,
|
||||||
|
message: "",
|
||||||
|
});
|
||||||
|
</script>
|
105
src/pages/tools/index.vue
Normal file
105
src/pages/tools/index.vue
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
<template>
|
||||||
|
<h3>工具</h3>
|
||||||
|
|
||||||
|
<v-btn color="primary" @click="to('/tools/create')">创建工具</v-btn>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<v-row
|
||||||
|
><v-slide-x-transition group>
|
||||||
|
<v-col
|
||||||
|
v-for="tool in tools.data"
|
||||||
|
:key="tool.id"
|
||||||
|
cols="12"
|
||||||
|
md="4"
|
||||||
|
sm="6"
|
||||||
|
>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>{{ tool.name }}</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<p>函数名称: {{ tool.data?.name }}</p>
|
||||||
|
<p>函数描述:{{ tool.data?.description }}</p>
|
||||||
|
<p>主页地址: {{ tool.data?.homepage_url }}</p>
|
||||||
|
</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<!-- <v-btn color="primary" @click="editAssistant(assistant)"
|
||||||
|
>编辑</v-btn
|
||||||
|
> -->
|
||||||
|
<v-btn color="error" @click="deleteTool(tool.id ?? 0)"
|
||||||
|
>删除</v-btn
|
||||||
|
>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-slide-x-transition></v-row
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-dialog v-model="dialog" max-width="290" persistent>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title class="headline">确认删除</v-card-title>
|
||||||
|
<v-card-text>您确定要删除这个工具吗?</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn color="green darken-1" @click="dialog = false">取消</v-btn>
|
||||||
|
<v-btn color="red darken-1" @click="deleteId">删除</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
|
||||||
|
<v-dialog v-model="failedDialog.show" max-width="290" persistent>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title class="headline">创建失败</v-card-title>
|
||||||
|
<v-card-text>{{ failedDialog.message }}</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn color="green darken-1" @click="failedDialog.show = false"
|
||||||
|
>关闭</v-btn
|
||||||
|
>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ApiV1ToolsGet200Response } from "@/api";
|
||||||
|
import { api } from "@/plugins/api";
|
||||||
|
import router from "@/router";
|
||||||
|
|
||||||
|
const tools: Ref<ApiV1ToolsGet200Response> = ref({});
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
api.Tool.apiV1ToolsGet().then((res) => {
|
||||||
|
tools.value = res.data;
|
||||||
|
console.log(tools.value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
refresh();
|
||||||
|
|
||||||
|
const dialog = ref(false);
|
||||||
|
const failedDialog = ref({
|
||||||
|
show: false,
|
||||||
|
message: "创建失败",
|
||||||
|
});
|
||||||
|
const selectedId = ref(0);
|
||||||
|
|
||||||
|
function deleteTool(id: number) {
|
||||||
|
selectedId.value = id;
|
||||||
|
dialog.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteId() {
|
||||||
|
api.Tool.apiV1ToolsIdDelete(selectedId.value)
|
||||||
|
.then(() => {
|
||||||
|
refresh();
|
||||||
|
})
|
||||||
|
.catch((r) => {
|
||||||
|
failedDialog.value.show = true;
|
||||||
|
failedDialog.value.message = r.response.data.error;
|
||||||
|
});
|
||||||
|
dialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function to(path: string) {
|
||||||
|
router.push(path);
|
||||||
|
}
|
||||||
|
</script>
|
4
src/typed-router.d.ts
vendored
4
src/typed-router.d.ts
vendored
@ -20,9 +20,13 @@ declare module 'vue-router/auto-routes' {
|
|||||||
export interface RouteNamedMap {
|
export interface RouteNamedMap {
|
||||||
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
|
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
|
||||||
'/assistants/': RouteRecordInfo<'/assistants/', '/assistants', Record<never, never>, Record<never, never>>,
|
'/assistants/': RouteRecordInfo<'/assistants/', '/assistants', Record<never, never>, Record<never, never>>,
|
||||||
|
'/assistants/[id]/tools': RouteRecordInfo<'/assistants/[id]/tools', '/assistants/:id/tools', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
|
'/assistants/binds': RouteRecordInfo<'/assistants/binds', '/assistants/binds', Record<never, never>, Record<never, never>>,
|
||||||
'/assistants/create': RouteRecordInfo<'/assistants/create', '/assistants/create', Record<never, never>, Record<never, never>>,
|
'/assistants/create': RouteRecordInfo<'/assistants/create', '/assistants/create', Record<never, never>, Record<never, never>>,
|
||||||
'/auth/callback': RouteRecordInfo<'/auth/callback', '/auth/callback', Record<never, never>, Record<never, never>>,
|
'/auth/callback': RouteRecordInfo<'/auth/callback', '/auth/callback', Record<never, never>, Record<never, never>>,
|
||||||
'/auth/login': RouteRecordInfo<'/auth/login', '/auth/login', Record<never, never>, Record<never, never>>,
|
'/auth/login': RouteRecordInfo<'/auth/login', '/auth/login', Record<never, never>, Record<never, never>>,
|
||||||
'/ping/': RouteRecordInfo<'/ping/', '/ping', Record<never, never>, Record<never, never>>,
|
'/ping/': RouteRecordInfo<'/ping/', '/ping', Record<never, never>, Record<never, never>>,
|
||||||
|
'/tools/': RouteRecordInfo<'/tools/', '/tools', Record<never, never>, Record<never, never>>,
|
||||||
|
'/tools/create': RouteRecordInfo<'/tools/create', '/tools/create', Record<never, never>, Record<never, never>>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user