optimize
This commit is contained in:
parent
db4fe8beca
commit
2001fb5e51
148
api/swagger.yaml
148
api/swagger.yaml
@ -32,7 +32,7 @@ definitions:
|
||||
rag-new_internal_entity.AssistantToolType:
|
||||
properties:
|
||||
assistant:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
assistant_id:
|
||||
type: integer
|
||||
created_at:
|
||||
@ -40,7 +40,7 @@ definitions:
|
||||
id:
|
||||
type: integer
|
||||
tool:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
tool_id:
|
||||
type: integer
|
||||
updated_at:
|
||||
@ -89,7 +89,7 @@ definitions:
|
||||
created_at:
|
||||
type: string
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutput'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutput"
|
||||
description:
|
||||
type: string
|
||||
discovery_url:
|
||||
@ -189,7 +189,7 @@ definitions:
|
||||
type: string
|
||||
function:
|
||||
items:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunctions'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunctions"
|
||||
type: array
|
||||
homepage_url:
|
||||
type: string
|
||||
@ -212,7 +212,7 @@ definitions:
|
||||
properties:
|
||||
function:
|
||||
items:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunction'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolDiscoveryOutputFunction"
|
||||
type: array
|
||||
type:
|
||||
type: string
|
||||
@ -233,17 +233,17 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取 Assistant 列表
|
||||
@ -258,7 +258,7 @@ paths:
|
||||
name: assistant
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.AssistantCreateRequest'
|
||||
$ref: "#/definitions/rag-new_internal_schema.AssistantCreateRequest"
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -266,15 +266,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 创建 Assistant
|
||||
@ -298,11 +298,11 @@ paths:
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 删除 Assistant
|
||||
@ -324,15 +324,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Assistant'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Assistant"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取指定的 Assistant
|
||||
@ -355,17 +355,17 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/rag-new_internal_entity.AssistantToolType'
|
||||
$ref: "#/definitions/rag-new_internal_entity.AssistantToolType"
|
||||
type: array
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取 Assistant 所绑定的 Tool
|
||||
@ -393,15 +393,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_entity.AssistantTool'
|
||||
$ref: "#/definitions/rag-new_internal_entity.AssistantTool"
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 解绑 Tool
|
||||
@ -428,15 +428,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_entity.AssistantTool'
|
||||
$ref: "#/definitions/rag-new_internal_entity.AssistantTool"
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 绑定 Tool
|
||||
@ -459,17 +459,17 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Chat'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Chat"
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
summary: 获取所有 Chat
|
||||
tags:
|
||||
- chat
|
||||
@ -483,7 +483,7 @@ paths:
|
||||
name: chat
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatCreateRequest'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatCreateRequest"
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -491,19 +491,19 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Chat'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Chat"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
summary: Create Chat
|
||||
tags:
|
||||
- chat
|
||||
@ -524,19 +524,19 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Delete Chat
|
||||
@ -560,25 +560,25 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/rag-new_internal_entity.ChatMessage'
|
||||
$ref: "#/definitions/rag-new_internal_entity.ChatMessage"
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 查看聊天记录
|
||||
@ -599,7 +599,7 @@ paths:
|
||||
name: message
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageAddRequest'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageAddRequest"
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -607,32 +607,32 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 添加聊天记录
|
||||
@ -650,15 +650,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_schema.CurrentUserResponse'
|
||||
$ref: "#/definitions/rag-new_internal_schema.CurrentUserResponse"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Greet
|
||||
@ -687,32 +687,32 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ChatMessageResponse'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ChatMessageResponse"
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- none: []
|
||||
summary: 流式传输聊天内容
|
||||
@ -730,17 +730,17 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: List Tool
|
||||
@ -756,7 +756,7 @@ paths:
|
||||
name: tool
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ToolCreateRequest'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ToolCreateRequest"
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -764,15 +764,15 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Create Tool
|
||||
@ -797,11 +797,11 @@ paths:
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: DeleteTool
|
||||
@ -824,19 +824,19 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
- $ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/rag-new_internal_entity.Tool'
|
||||
$ref: "#/definitions/rag-new_internal_entity.Tool"
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/rag-new_internal_schema.ResponseBody'
|
||||
$ref: "#/definitions/rag-new_internal_schema.ResponseBody"
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get Tool
|
||||
|
1720
src/api/api.ts
1720
src/api/api.ts
File diff suppressed because it is too large
Load Diff
@ -12,12 +12,11 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import type { Configuration } from './configuration';
|
||||
import type { Configuration } from "./configuration";
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
||||
import globalAxios from 'axios';
|
||||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from "axios";
|
||||
import globalAxios from "axios";
|
||||
|
||||
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
||||
|
||||
@ -50,13 +49,17 @@ export interface RequestArgs {
|
||||
export class BaseAPI {
|
||||
protected configuration: Configuration | undefined;
|
||||
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
constructor(
|
||||
configuration?: Configuration,
|
||||
protected basePath: string = BASE_PATH,
|
||||
protected axios: AxiosInstance = globalAxios,
|
||||
) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePath ?? basePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -65,16 +68,19 @@ export class BaseAPI {
|
||||
* @extends {Error}
|
||||
*/
|
||||
export class RequiredError extends Error {
|
||||
constructor(public field: string, msg?: string) {
|
||||
constructor(
|
||||
public field: string,
|
||||
msg?: string,
|
||||
) {
|
||||
super(msg);
|
||||
this.name = "RequiredError"
|
||||
this.name = "RequiredError";
|
||||
}
|
||||
}
|
||||
|
||||
interface ServerMap {
|
||||
[key: string]: {
|
||||
url: string,
|
||||
description: string,
|
||||
url: string;
|
||||
description: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
@ -82,5 +88,4 @@ interface ServerMap {
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const operationServerMap: ServerMap = {
|
||||
}
|
||||
export const operationServerMap: ServerMap = {};
|
||||
|
@ -12,95 +12,129 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import type { Configuration } from "./configuration";
|
||||
import type { RequestArgs } from "./base";
|
||||
import type { AxiosInstance, AxiosResponse } from 'axios';
|
||||
import type { AxiosInstance, AxiosResponse } from "axios";
|
||||
import { RequiredError } from "./base";
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const DUMMY_BASE_URL = 'https://example.com'
|
||||
export const DUMMY_BASE_URL = "https://example.com";
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws {RequiredError}
|
||||
* @export
|
||||
*/
|
||||
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||
export const assertParamExists = function (
|
||||
functionName: string,
|
||||
paramName: string,
|
||||
paramValue: unknown,
|
||||
) {
|
||||
if (paramValue === null || paramValue === undefined) {
|
||||
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||
}
|
||||
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) {
|
||||
export const setApiKeyToObject = async function (
|
||||
object: any,
|
||||
keyParamName: string,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
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) {
|
||||
export const setBasicAuthToObject = function (
|
||||
object: any,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
if (configuration && (configuration.username || configuration.password)) {
|
||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||
}
|
||||
object["auth"] = {
|
||||
username: configuration.username,
|
||||
password: configuration.password,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||
export const setBearerAuthToObject = async function (
|
||||
object: any,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const accessToken = typeof configuration.accessToken === 'function'
|
||||
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) {
|
||||
export const setOAuthToObject = async function (
|
||||
object: any,
|
||||
name: string,
|
||||
scopes: string[],
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
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 {
|
||||
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}`)
|
||||
(parameter as any[]).forEach((item) =>
|
||||
setFlattenedQueryParams(urlSearchParams, item, key),
|
||||
);
|
||||
} else {
|
||||
Object.keys(parameter).forEach((currentKey) =>
|
||||
setFlattenedQueryParams(
|
||||
urlSearchParams,
|
||||
parameter[currentKey],
|
||||
`${key}${key !== "" ? "." : ""}${currentKey}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (urlSearchParams.has(key)) {
|
||||
urlSearchParams.append(key, parameter);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
urlSearchParams.set(key, parameter);
|
||||
}
|
||||
}
|
||||
@ -114,37 +148,55 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||
const searchParams = new URLSearchParams(url.search);
|
||||
setFlattenedQueryParams(searchParams, objects);
|
||||
url.search = searchParams.toString();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||
const nonString = typeof value !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||
export const serializeDataIfNeeded = function (
|
||||
value: any,
|
||||
requestOptions: any,
|
||||
configuration?: Configuration,
|
||||
) {
|
||||
const nonString = typeof value !== "string";
|
||||
const needsSerialization =
|
||||
nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers["Content-Type"])
|
||||
: nonString;
|
||||
return needsSerialization
|
||||
? JSON.stringify(value !== undefined ? value : {})
|
||||
: (value || "");
|
||||
}
|
||||
: value || "";
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const toPathString = function (url: URL) {
|
||||
return url.pathname + url.search + url.hash
|
||||
}
|
||||
return url.pathname + url.search + url.hash;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, 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};
|
||||
export const createRequestFunction = function (
|
||||
axiosArgs: RequestArgs,
|
||||
globalAxios: AxiosInstance,
|
||||
BASE_PATH: string,
|
||||
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);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -12,12 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
apiKey?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name: string) => string)
|
||||
| ((name: string) => Promise<string>);
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
accessToken?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name?: string, scopes?: string[]) => string)
|
||||
| ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
basePath?: string;
|
||||
serverIndex?: number;
|
||||
baseOptions?: any;
|
||||
@ -30,7 +37,11 @@ export class Configuration {
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
apiKey?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name: string) => string)
|
||||
| ((name: string) => Promise<string>);
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
@ -51,7 +62,11 @@ export class Configuration {
|
||||
* @param scopes oauth2 scope
|
||||
* @memberof Configuration
|
||||
*/
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
accessToken?:
|
||||
| string
|
||||
| Promise<string>
|
||||
| ((name?: string, scopes?: string[]) => string)
|
||||
| ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
@ -104,7 +119,14 @@ export class Configuration {
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
const jsonMime: RegExp = new RegExp(
|
||||
"^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$",
|
||||
"i",
|
||||
);
|
||||
return (
|
||||
mime !== null &&
|
||||
(jsonMime.test(mime) ||
|
||||
mime.toLowerCase() === "application/json-patch+json")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,5 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export * from "./api";
|
||||
export * from "./configuration";
|
||||
|
||||
|
424
src/auto-imports.d.ts
vendored
424
src/auto-imports.d.ts
vendored
@ -5,187 +5,271 @@
|
||||
// Generated by unplugin-auto-import
|
||||
export {}
|
||||
declare global {
|
||||
const EffectScope: typeof import('vue')['EffectScope']
|
||||
const computed: typeof import('vue')['computed']
|
||||
const createApp: typeof import('vue')['createApp']
|
||||
const customRef: typeof import('vue')['customRef']
|
||||
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||
const defineComponent: typeof import('vue')['defineComponent']
|
||||
const effectScope: typeof import('vue')['effectScope']
|
||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||
const h: typeof import('vue')['h']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
const isReadonly: typeof import('vue')['isReadonly']
|
||||
const isRef: typeof import('vue')['isRef']
|
||||
const markRaw: typeof import('vue')['markRaw']
|
||||
const nextTick: typeof import('vue')['nextTick']
|
||||
const onActivated: typeof import('vue')['onActivated']
|
||||
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"]
|
||||
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"]
|
||||
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||
const onMounted: typeof import('vue')['onMounted']
|
||||
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||
const onUpdated: typeof import('vue')['onUpdated']
|
||||
const provide: typeof import('vue')['provide']
|
||||
const reactive: typeof import('vue')['reactive']
|
||||
const readonly: typeof import('vue')['readonly']
|
||||
const ref: typeof import('vue')['ref']
|
||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||
const shallowRef: typeof import('vue')['shallowRef']
|
||||
const toRaw: typeof import('vue')['toRaw']
|
||||
const toRef: typeof import('vue')['toRef']
|
||||
const toRefs: typeof import('vue')['toRefs']
|
||||
const toValue: typeof import('vue')['toValue']
|
||||
const triggerRef: typeof import('vue')['triggerRef']
|
||||
const unref: typeof import('vue')['unref']
|
||||
const useAttrs: typeof import('vue')['useAttrs']
|
||||
const useCssModule: typeof import('vue')['useCssModule']
|
||||
const useCssVars: typeof import('vue')['useCssVars']
|
||||
const useLink: (typeof import("vue-router"))["useLink"]
|
||||
const useRoute: typeof import('vue-router/auto')['useRoute']
|
||||
const useRouter: typeof import('vue-router/auto')['useRouter']
|
||||
const useSlots: typeof import('vue')['useSlots']
|
||||
const watch: typeof import('vue')['watch']
|
||||
const watchEffect: typeof import('vue')['watchEffect']
|
||||
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||
const EffectScope: (typeof import("vue"))["EffectScope"];
|
||||
const computed: (typeof import("vue"))["computed"];
|
||||
const createApp: (typeof import("vue"))["createApp"];
|
||||
const customRef: (typeof import("vue"))["customRef"];
|
||||
const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"];
|
||||
const defineComponent: (typeof import("vue"))["defineComponent"];
|
||||
const effectScope: (typeof import("vue"))["effectScope"];
|
||||
const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"];
|
||||
const getCurrentScope: (typeof import("vue"))["getCurrentScope"];
|
||||
const h: (typeof import("vue"))["h"];
|
||||
const inject: (typeof import("vue"))["inject"];
|
||||
const isProxy: (typeof import("vue"))["isProxy"];
|
||||
const isReactive: (typeof import("vue"))["isReactive"];
|
||||
const isReadonly: (typeof import("vue"))["isReadonly"];
|
||||
const isRef: (typeof import("vue"))["isRef"];
|
||||
const markRaw: (typeof import("vue"))["markRaw"];
|
||||
const nextTick: (typeof import("vue"))["nextTick"];
|
||||
const onActivated: (typeof import("vue"))["onActivated"];
|
||||
const onBeforeMount: (typeof import("vue"))["onBeforeMount"];
|
||||
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"];
|
||||
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"];
|
||||
const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"];
|
||||
const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"];
|
||||
const onDeactivated: (typeof import("vue"))["onDeactivated"];
|
||||
const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"];
|
||||
const onMounted: (typeof import("vue"))["onMounted"];
|
||||
const onRenderTracked: (typeof import("vue"))["onRenderTracked"];
|
||||
const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"];
|
||||
const onScopeDispose: (typeof import("vue"))["onScopeDispose"];
|
||||
const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"];
|
||||
const onUnmounted: (typeof import("vue"))["onUnmounted"];
|
||||
const onUpdated: (typeof import("vue"))["onUpdated"];
|
||||
const provide: (typeof import("vue"))["provide"];
|
||||
const reactive: (typeof import("vue"))["reactive"];
|
||||
const readonly: (typeof import("vue"))["readonly"];
|
||||
const ref: (typeof import("vue"))["ref"];
|
||||
const resolveComponent: (typeof import("vue"))["resolveComponent"];
|
||||
const shallowReactive: (typeof import("vue"))["shallowReactive"];
|
||||
const shallowReadonly: (typeof import("vue"))["shallowReadonly"];
|
||||
const shallowRef: (typeof import("vue"))["shallowRef"];
|
||||
const toRaw: (typeof import("vue"))["toRaw"];
|
||||
const toRef: (typeof import("vue"))["toRef"];
|
||||
const toRefs: (typeof import("vue"))["toRefs"];
|
||||
const toValue: (typeof import("vue"))["toValue"];
|
||||
const triggerRef: (typeof import("vue"))["triggerRef"];
|
||||
const unref: (typeof import("vue"))["unref"];
|
||||
const useAttrs: (typeof import("vue"))["useAttrs"];
|
||||
const useCssModule: (typeof import("vue"))["useCssModule"];
|
||||
const useCssVars: (typeof import("vue"))["useCssVars"];
|
||||
const useLink: (typeof import("vue-router"))["useLink"];
|
||||
const useRoute: (typeof import("vue-router/auto"))["useRoute"];
|
||||
const useRouter: (typeof import("vue-router/auto"))["useRouter"];
|
||||
const useSlots: (typeof import("vue"))["useSlots"];
|
||||
const watch: (typeof import("vue"))["watch"];
|
||||
const watchEffect: (typeof import("vue"))["watchEffect"];
|
||||
const watchPostEffect: (typeof import("vue"))["watchPostEffect"];
|
||||
const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"];
|
||||
}
|
||||
// for type re-export
|
||||
declare global {
|
||||
// @ts-ignore
|
||||
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
|
||||
import('vue')
|
||||
export type {
|
||||
Component,
|
||||
ComponentPublicInstance,
|
||||
ComputedRef,
|
||||
ExtractDefaultPropTypes,
|
||||
ExtractPropTypes,
|
||||
ExtractPublicPropTypes,
|
||||
InjectionKey,
|
||||
PropType,
|
||||
Ref,
|
||||
VNode,
|
||||
WritableComputedRef,
|
||||
} from "vue";
|
||||
import("vue");
|
||||
}
|
||||
// for vue template auto import
|
||||
import { UnwrapRef } from 'vue'
|
||||
declare module 'vue' {
|
||||
import { UnwrapRef } from "vue";
|
||||
declare module "vue" {
|
||||
interface GlobalComponents {}
|
||||
interface ComponentCustomProperties {
|
||||
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
|
||||
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
|
||||
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
||||
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
||||
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
|
||||
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
|
||||
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
|
||||
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
|
||||
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
|
||||
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
|
||||
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
|
||||
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
|
||||
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
|
||||
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
|
||||
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
|
||||
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
|
||||
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
|
||||
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
|
||||
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
|
||||
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
|
||||
readonly ref: UnwrapRef<typeof import('vue')['ref']>
|
||||
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
|
||||
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
|
||||
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
|
||||
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
|
||||
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
|
||||
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
|
||||
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
|
||||
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
|
||||
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
|
||||
readonly unref: UnwrapRef<typeof import('vue')['unref']>
|
||||
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
|
||||
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
||||
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
|
||||
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
|
||||
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
||||
readonly watch: UnwrapRef<typeof import('vue')['watch']>
|
||||
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
|
||||
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
|
||||
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
|
||||
readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>;
|
||||
readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>;
|
||||
readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>;
|
||||
readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>;
|
||||
readonly defineAsyncComponent: UnwrapRef<
|
||||
(typeof import("vue"))["defineAsyncComponent"]
|
||||
>;
|
||||
readonly defineComponent: UnwrapRef<
|
||||
(typeof import("vue"))["defineComponent"]
|
||||
>;
|
||||
readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>;
|
||||
readonly getCurrentInstance: UnwrapRef<
|
||||
(typeof import("vue"))["getCurrentInstance"]
|
||||
>;
|
||||
readonly getCurrentScope: UnwrapRef<
|
||||
(typeof import("vue"))["getCurrentScope"]
|
||||
>;
|
||||
readonly h: UnwrapRef<(typeof import("vue"))["h"]>;
|
||||
readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>;
|
||||
readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>;
|
||||
readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>;
|
||||
readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>;
|
||||
readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>;
|
||||
readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>;
|
||||
readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>;
|
||||
readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>;
|
||||
readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>;
|
||||
readonly onBeforeUnmount: UnwrapRef<
|
||||
(typeof import("vue"))["onBeforeUnmount"]
|
||||
>;
|
||||
readonly onBeforeUpdate: UnwrapRef<
|
||||
(typeof import("vue"))["onBeforeUpdate"]
|
||||
>;
|
||||
readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>;
|
||||
readonly onErrorCaptured: UnwrapRef<
|
||||
(typeof import("vue"))["onErrorCaptured"]
|
||||
>;
|
||||
readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>;
|
||||
readonly onRenderTracked: UnwrapRef<
|
||||
(typeof import("vue"))["onRenderTracked"]
|
||||
>;
|
||||
readonly onRenderTriggered: UnwrapRef<
|
||||
(typeof import("vue"))["onRenderTriggered"]
|
||||
>;
|
||||
readonly onScopeDispose: UnwrapRef<
|
||||
(typeof import("vue"))["onScopeDispose"]
|
||||
>;
|
||||
readonly onServerPrefetch: UnwrapRef<
|
||||
(typeof import("vue"))["onServerPrefetch"]
|
||||
>;
|
||||
readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>;
|
||||
readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>;
|
||||
readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>;
|
||||
readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>;
|
||||
readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>;
|
||||
readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>;
|
||||
readonly resolveComponent: UnwrapRef<
|
||||
(typeof import("vue"))["resolveComponent"]
|
||||
>;
|
||||
readonly shallowReactive: UnwrapRef<
|
||||
(typeof import("vue"))["shallowReactive"]
|
||||
>;
|
||||
readonly shallowReadonly: UnwrapRef<
|
||||
(typeof import("vue"))["shallowReadonly"]
|
||||
>;
|
||||
readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>;
|
||||
readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>;
|
||||
readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>;
|
||||
readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>;
|
||||
readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>;
|
||||
readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>;
|
||||
readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>;
|
||||
readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>;
|
||||
readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>;
|
||||
readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>;
|
||||
readonly useRoute: UnwrapRef<
|
||||
(typeof import("vue-router/auto"))["useRoute"]
|
||||
>;
|
||||
readonly useRouter: UnwrapRef<
|
||||
(typeof import("vue-router/auto"))["useRouter"]
|
||||
>;
|
||||
readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>;
|
||||
readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>;
|
||||
readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>;
|
||||
readonly watchPostEffect: UnwrapRef<
|
||||
(typeof import("vue"))["watchPostEffect"]
|
||||
>;
|
||||
readonly watchSyncEffect: UnwrapRef<
|
||||
(typeof import("vue"))["watchSyncEffect"]
|
||||
>;
|
||||
}
|
||||
}
|
||||
declare module '@vue/runtime-core' {
|
||||
declare module "@vue/runtime-core" {
|
||||
interface GlobalComponents {}
|
||||
interface ComponentCustomProperties {
|
||||
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
|
||||
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
|
||||
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
||||
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
||||
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
|
||||
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
|
||||
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
|
||||
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
|
||||
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
|
||||
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
|
||||
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
|
||||
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
|
||||
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
|
||||
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
|
||||
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
|
||||
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
|
||||
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
|
||||
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
|
||||
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
|
||||
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
|
||||
readonly ref: UnwrapRef<typeof import('vue')['ref']>
|
||||
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
|
||||
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
|
||||
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
|
||||
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
|
||||
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
|
||||
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
|
||||
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
|
||||
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
|
||||
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
|
||||
readonly unref: UnwrapRef<typeof import('vue')['unref']>
|
||||
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
|
||||
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
||||
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
|
||||
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
|
||||
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
||||
readonly watch: UnwrapRef<typeof import('vue')['watch']>
|
||||
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
|
||||
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
|
||||
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
|
||||
readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>;
|
||||
readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>;
|
||||
readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>;
|
||||
readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>;
|
||||
readonly defineAsyncComponent: UnwrapRef<
|
||||
(typeof import("vue"))["defineAsyncComponent"]
|
||||
>;
|
||||
readonly defineComponent: UnwrapRef<
|
||||
(typeof import("vue"))["defineComponent"]
|
||||
>;
|
||||
readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>;
|
||||
readonly getCurrentInstance: UnwrapRef<
|
||||
(typeof import("vue"))["getCurrentInstance"]
|
||||
>;
|
||||
readonly getCurrentScope: UnwrapRef<
|
||||
(typeof import("vue"))["getCurrentScope"]
|
||||
>;
|
||||
readonly h: UnwrapRef<(typeof import("vue"))["h"]>;
|
||||
readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>;
|
||||
readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>;
|
||||
readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>;
|
||||
readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>;
|
||||
readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>;
|
||||
readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>;
|
||||
readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>;
|
||||
readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>;
|
||||
readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>;
|
||||
readonly onBeforeUnmount: UnwrapRef<
|
||||
(typeof import("vue"))["onBeforeUnmount"]
|
||||
>;
|
||||
readonly onBeforeUpdate: UnwrapRef<
|
||||
(typeof import("vue"))["onBeforeUpdate"]
|
||||
>;
|
||||
readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>;
|
||||
readonly onErrorCaptured: UnwrapRef<
|
||||
(typeof import("vue"))["onErrorCaptured"]
|
||||
>;
|
||||
readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>;
|
||||
readonly onRenderTracked: UnwrapRef<
|
||||
(typeof import("vue"))["onRenderTracked"]
|
||||
>;
|
||||
readonly onRenderTriggered: UnwrapRef<
|
||||
(typeof import("vue"))["onRenderTriggered"]
|
||||
>;
|
||||
readonly onScopeDispose: UnwrapRef<
|
||||
(typeof import("vue"))["onScopeDispose"]
|
||||
>;
|
||||
readonly onServerPrefetch: UnwrapRef<
|
||||
(typeof import("vue"))["onServerPrefetch"]
|
||||
>;
|
||||
readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>;
|
||||
readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>;
|
||||
readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>;
|
||||
readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>;
|
||||
readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>;
|
||||
readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>;
|
||||
readonly resolveComponent: UnwrapRef<
|
||||
(typeof import("vue"))["resolveComponent"]
|
||||
>;
|
||||
readonly shallowReactive: UnwrapRef<
|
||||
(typeof import("vue"))["shallowReactive"]
|
||||
>;
|
||||
readonly shallowReadonly: UnwrapRef<
|
||||
(typeof import("vue"))["shallowReadonly"]
|
||||
>;
|
||||
readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>;
|
||||
readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>;
|
||||
readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>;
|
||||
readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>;
|
||||
readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>;
|
||||
readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>;
|
||||
readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>;
|
||||
readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>;
|
||||
readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>;
|
||||
readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>;
|
||||
readonly useRoute: UnwrapRef<
|
||||
(typeof import("vue-router/auto"))["useRoute"]
|
||||
>;
|
||||
readonly useRouter: UnwrapRef<
|
||||
(typeof import("vue-router/auto"))["useRouter"]
|
||||
>;
|
||||
readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>;
|
||||
readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>;
|
||||
readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>;
|
||||
readonly watchPostEffect: UnwrapRef<
|
||||
(typeof import("vue"))["watchPostEffect"]
|
||||
>;
|
||||
readonly watchSyncEffect: UnwrapRef<
|
||||
(typeof import("vue"))["watchSyncEffect"]
|
||||
>;
|
||||
}
|
||||
}
|
||||
|
2
src/components.d.ts
vendored
2
src/components.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
export {}
|
||||
export {};
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
|
@ -3,7 +3,11 @@
|
||||
<v-navigation-drawer v-model="appStore.navigation_drawer">
|
||||
<div class="pa-2">
|
||||
<v-btn-group rounded="lg">
|
||||
<v-btn density="default" icon="mdi-close" @click="appStore.navigation_drawer = !appStore.navigation_drawer" />
|
||||
<v-btn
|
||||
density="default"
|
||||
icon="mdi-close"
|
||||
@click="appStore.navigation_drawer = !appStore.navigation_drawer"
|
||||
/>
|
||||
|
||||
<v-btn density="default" icon="mdi-plus" title="创建助理" />
|
||||
</v-btn-group>
|
||||
@ -13,47 +17,66 @@
|
||||
|
||||
<v-list density="compact" nav>
|
||||
<template v-for="item in appStore.navigation_items">
|
||||
<v-list-item :prepend-icon="item.icon" rounded="lg" :title="item.text" :to="item.to" />
|
||||
<v-list-item
|
||||
:prepend-icon="item.icon"
|
||||
rounded="lg"
|
||||
:title="item.text"
|
||||
:to="item.to"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<v-list-item
|
||||
v-show="!userStore.logined"
|
||||
prepend-icon="mdi-account"
|
||||
rounded="xl"
|
||||
title="登录"
|
||||
to="/auth/login"
|
||||
/>
|
||||
|
||||
<v-list-item v-show="!userStore.logined" prepend-icon="mdi-account" rounded="xl" title="登录" to="/auth/login" />
|
||||
|
||||
<template v-if="chats.data != null" v-for="chat in chats.data" :key="chat.id">
|
||||
<v-list-item prepend-icon="mdi-chat" rounded="lg" :title="chat?.name" :to="'/chats/' + chat.id" />
|
||||
<template
|
||||
v-if="chats.data != null"
|
||||
v-for="chat in chats.data"
|
||||
:key="chat.id"
|
||||
>
|
||||
<v-list-item
|
||||
prepend-icon="mdi-chat"
|
||||
rounded="lg"
|
||||
:title="chat?.name"
|
||||
:to="'/chats/' + chat.id"
|
||||
/>
|
||||
</template>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-app-bar>
|
||||
<v-app-bar-nav-icon @click="appStore.navigation_drawer = !appStore.navigation_drawer" />
|
||||
<v-app-bar-nav-icon
|
||||
@click="appStore.navigation_drawer = !appStore.navigation_drawer"
|
||||
/>
|
||||
|
||||
<v-app-bar-title>{{ configStore.app_name }}</v-app-bar-title>
|
||||
</v-app-bar>
|
||||
<!-- </v-app> -->
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useConfigStore } from "@/stores/config"
|
||||
import { useUserStore } from "@/stores/user"
|
||||
import { useAppStore } from "@/stores/app"
|
||||
import { useChatStore } from "@/stores/chat"
|
||||
import { computed } from "vue"
|
||||
import { ApiV1ChatsGet200Response } from "@/api"
|
||||
import { useConfigStore } from "@/stores/config";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { useAppStore } from "@/stores/app";
|
||||
import { useChatStore } from "@/stores/chat";
|
||||
import { computed } from "vue";
|
||||
import { ApiV1ChatsGet200Response } from "@/api";
|
||||
|
||||
|
||||
const chatStore = useChatStore()
|
||||
const configStore = useConfigStore()
|
||||
const userStore = useUserStore()
|
||||
const appStore = useAppStore()
|
||||
const chatStore = useChatStore();
|
||||
const configStore = useConfigStore();
|
||||
const userStore = useUserStore();
|
||||
const appStore = useAppStore();
|
||||
|
||||
const chats = computed<ApiV1ChatsGet200Response>(() => {
|
||||
return chatStore.chats
|
||||
})
|
||||
chatStore.getChats()
|
||||
return chatStore.chats;
|
||||
});
|
||||
chatStore.getChats();
|
||||
|
||||
// 恼
|
||||
// setInterval(() => {
|
||||
// chats.value.data = chatStore.chats.data
|
||||
// }, 10 * 1000)
|
||||
|
||||
</script>
|
||||
|
@ -30,52 +30,52 @@
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue"
|
||||
import { api } from "@/plugins/api"
|
||||
import { ApiV1AssistantsPost200Response, ApiV1ChatsGet200Response, RagNewInternalSchemaChatCreateRequest } from "@/api"
|
||||
import router from "@/router"
|
||||
import { useChatStore } from '../../../stores/chat'
|
||||
import { ref } from "vue";
|
||||
import { api } from "@/plugins/api";
|
||||
import {
|
||||
ApiV1AssistantsPost200Response,
|
||||
ApiV1ChatsGet200Response,
|
||||
RagNewInternalSchemaChatCreateRequest,
|
||||
} from "@/api";
|
||||
import router from "@/router";
|
||||
import { useChatStore } from "../../../stores/chat";
|
||||
// @ts-ignore
|
||||
const assistantId = router.currentRoute.value.params.id as number
|
||||
const assistant: Ref<ApiV1AssistantsPost200Response> = ref({})
|
||||
const chats = ref<ApiV1ChatsGet200Response>({})
|
||||
const assistantId = router.currentRoute.value.params.id as number;
|
||||
const assistant: Ref<ApiV1AssistantsPost200Response> = ref({});
|
||||
const chats = ref<ApiV1ChatsGet200Response>({});
|
||||
|
||||
const dialog = ref(false)
|
||||
const dialog = ref(false);
|
||||
const chat: Ref<RagNewInternalSchemaChatCreateRequest> = ref({
|
||||
name: '',
|
||||
name: "",
|
||||
assistant_id: parseInt(assistantId.toString()),
|
||||
})
|
||||
});
|
||||
|
||||
const chatStore = useChatStore()
|
||||
const chatStore = useChatStore();
|
||||
|
||||
function getAssistant() {
|
||||
api.Assistant.apiV1AssistantsIdGet(assistantId).then((res) => {
|
||||
assistant.value = res.data
|
||||
})
|
||||
assistant.value = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
function getChats() {
|
||||
api.Chat.apiV1ChatsGet(assistantId).then((res) => {
|
||||
chats.value = res.data
|
||||
})
|
||||
chats.value = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
function createChat() {
|
||||
api.Chat.apiV1ChatsPost(chat.value).then((res) => {
|
||||
getChats()
|
||||
dialog.value = false
|
||||
})
|
||||
|
||||
chatStore.getChats()
|
||||
getChats();
|
||||
dialog.value = false;
|
||||
});
|
||||
|
||||
chatStore.getChats();
|
||||
}
|
||||
|
||||
|
||||
getAssistant()
|
||||
getChats()
|
||||
|
||||
getAssistant();
|
||||
getChats();
|
||||
</script>
|
@ -1,12 +1,20 @@
|
||||
<template>
|
||||
<h3>你创建的助理</h3>
|
||||
|
||||
<v-btn color="primary" class="mt-3 mb-3" @click="to('/assistants/create')">创建助理</v-btn>
|
||||
<v-btn color="primary" class="mt-3 mb-3" @click="to('/assistants/create')"
|
||||
>创建助理</v-btn
|
||||
>
|
||||
|
||||
<div class="mt-3">
|
||||
<v-row>
|
||||
<v-slide-x-transition group>
|
||||
<v-col v-for="assistant in assistants.data" :key="assistant.id" cols="12" md="4" sm="6">
|
||||
<v-col
|
||||
v-for="assistant in assistants.data"
|
||||
:key="assistant.id"
|
||||
cols="12"
|
||||
md="4"
|
||||
sm="6"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title>{{ assistant.name }}</v-card-title>
|
||||
<v-card-text>
|
||||
@ -18,8 +26,12 @@
|
||||
对话
|
||||
</v-btn>
|
||||
|
||||
<v-btn color="primary" @click="editTool(assistant.id ?? 0)">工具</v-btn>
|
||||
<v-btn color="error" @click="deleteAssistant(assistant.id ?? 0)">删除</v-btn>
|
||||
<v-btn color="primary" @click="editTool(assistant.id ?? 0)"
|
||||
>工具</v-btn
|
||||
>
|
||||
<v-btn color="error" @click="deleteAssistant(assistant.id ?? 0)"
|
||||
>删除</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-col>
|
||||
@ -34,7 +46,9 @@
|
||||
<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="deleteAssistantConfirmed">删除</v-btn>
|
||||
<v-btn color="red darken-1" @click="deleteAssistantConfirmed"
|
||||
>删除</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
@ -45,62 +59,63 @@
|
||||
<v-card-text>{{ deleteResult.message }}</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="green darken-1" @click="deleteResult.show = false">确定</v-btn>
|
||||
<v-btn color="green darken-1" @click="deleteResult.show = false"
|
||||
>确定</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ApiV1AssistantsGet200Response } from "@/api"
|
||||
import { api } from "@/plugins/api"
|
||||
import router from "@/router"
|
||||
import { ApiV1AssistantsGet200Response } from "@/api";
|
||||
import { api } from "@/plugins/api";
|
||||
import router from "@/router";
|
||||
|
||||
const assistants: Ref<ApiV1AssistantsGet200Response> = ref({})
|
||||
const assistants: Ref<ApiV1AssistantsGet200Response> = ref({});
|
||||
|
||||
function refresh() {
|
||||
api.Assistant.apiV1AssistantsGet().then((res) => {
|
||||
assistants.value = res.data
|
||||
})
|
||||
assistants.value = res.data;
|
||||
});
|
||||
}
|
||||
refresh()
|
||||
refresh();
|
||||
|
||||
const dialog = ref(false)
|
||||
const selectedAssistantId = ref(0)
|
||||
const dialog = ref(false);
|
||||
const selectedAssistantId = ref(0);
|
||||
const deleteResult = ref({
|
||||
show: false,
|
||||
message: "",
|
||||
})
|
||||
});
|
||||
|
||||
function deleteAssistant(assistantId: number) {
|
||||
selectedAssistantId.value = assistantId
|
||||
dialog.value = true
|
||||
selectedAssistantId.value = assistantId;
|
||||
dialog.value = true;
|
||||
}
|
||||
|
||||
function deleteAssistantConfirmed() {
|
||||
api.Assistant.apiV1AssistantsIdDelete(selectedAssistantId.value).then(() => {
|
||||
deleteResult.value.message = "正在批量删除与该助理关联的数据,可能需要一段时间才会从列表中消失"
|
||||
|
||||
}).catch((r) => {
|
||||
deleteResult.value.message = r.response.data.error
|
||||
api.Assistant.apiV1AssistantsIdDelete(selectedAssistantId.value)
|
||||
.then(() => {
|
||||
deleteResult.value.message =
|
||||
"正在批量删除与该助理关联的数据,可能需要一段时间才会从列表中消失";
|
||||
})
|
||||
dialog.value = false
|
||||
deleteResult.value.show = true
|
||||
refresh()
|
||||
.catch((r) => {
|
||||
deleteResult.value.message = r.response.data.error;
|
||||
});
|
||||
dialog.value = false;
|
||||
deleteResult.value.show = true;
|
||||
refresh();
|
||||
}
|
||||
|
||||
function editTool(assistantId: number) {
|
||||
router.push(`/assistants/${assistantId}/tools`)
|
||||
router.push(`/assistants/${assistantId}/tools`);
|
||||
}
|
||||
|
||||
function showChats(assistantId: number) {
|
||||
router.push(`/assistants/${assistantId}/chats`)
|
||||
router.push(`/assistants/${assistantId}/chats`);
|
||||
}
|
||||
|
||||
|
||||
function to(path: string) {
|
||||
router.push(path)
|
||||
router.push(path);
|
||||
}
|
||||
</script>
|
||||
|
@ -2,20 +2,18 @@
|
||||
<div>
|
||||
<h3 class="mb-3">聊天记录</h3>
|
||||
|
||||
|
||||
<v-card class="mx-auto mt-3 " width="100%" v-for="message in messages.data" :key="message.id">
|
||||
<v-card
|
||||
class="mx-auto mt-3"
|
||||
width="100%"
|
||||
v-for="message in messages.data"
|
||||
:key="message.id"
|
||||
>
|
||||
<template v-slot:title>
|
||||
<span class="font-weight-black">
|
||||
<span v-if="message.role == 'assistant'">
|
||||
AI
|
||||
</span>
|
||||
<span v-else-if="message.role == 'system'">
|
||||
系统
|
||||
</span>
|
||||
<span v-if="message.role == 'assistant'"> AI </span>
|
||||
<span v-else-if="message.role == 'system'"> 系统 </span>
|
||||
|
||||
<span v-else-if="message.role == 'user'">
|
||||
用户
|
||||
</span>
|
||||
<span v-else-if="message.role == 'user'"> 用户 </span>
|
||||
|
||||
<span v-else>
|
||||
{{ message.role }}
|
||||
@ -31,122 +29,124 @@
|
||||
|
||||
<div class="mt-3">
|
||||
<div v-show="toolName != ''">
|
||||
<v-progress-circular :size="16" color="primary" indeterminate></v-progress-circular>
|
||||
<v-progress-circular
|
||||
:size="16"
|
||||
color="primary"
|
||||
indeterminate
|
||||
></v-progress-circular>
|
||||
{{ toolName }}
|
||||
</div>
|
||||
<v-text-field v-model="input" label="输入消息" @keyup.enter="sendMessage"></v-text-field>
|
||||
<v-text-field
|
||||
v-model="input"
|
||||
label="输入消息"
|
||||
@keyup.enter="sendMessage"
|
||||
></v-text-field>
|
||||
<v-btn color="primary" @click="sendMessage">发送</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ApiV1ChatsIdMessagesGet200Response } from "@/api"
|
||||
import { ref } from "vue"
|
||||
import { api, conf } from "@/plugins/api"
|
||||
import VueMarkdown from 'vue-markdown-render'
|
||||
import { ApiV1ChatsIdMessagesGet200Response } from "@/api";
|
||||
import { ref } from "vue";
|
||||
import { api, conf } from "@/plugins/api";
|
||||
import VueMarkdown from "vue-markdown-render";
|
||||
|
||||
// @ts-ignore
|
||||
const chatId = parseInt(useRoute().params.id as string)
|
||||
const chatId = parseInt(useRoute().params.id as string);
|
||||
|
||||
const messages: Ref<ApiV1ChatsIdMessagesGet200Response> = ref({
|
||||
data: []
|
||||
})
|
||||
const input = ref("")
|
||||
const toolName = ref("")
|
||||
data: [],
|
||||
});
|
||||
const input = ref("");
|
||||
const toolName = ref("");
|
||||
|
||||
function sendMessage() {
|
||||
if (input.value != "") {
|
||||
api.ChatMessage.apiV1ChatsIdMessagesPost(chatId, {
|
||||
message: input.value
|
||||
}).then((res) => {
|
||||
message: input.value,
|
||||
})
|
||||
.then((res) => {
|
||||
const newMessage = {
|
||||
content: input.value,
|
||||
role: "user",
|
||||
}
|
||||
};
|
||||
|
||||
if (messages.value.data == null) {
|
||||
messages.value.data = [newMessage]
|
||||
messages.value.data = [newMessage];
|
||||
} else {
|
||||
messages.value.data?.push(newMessage)
|
||||
messages.value.data?.push(newMessage);
|
||||
}
|
||||
|
||||
|
||||
const streamId = res.data.data?.stream_id
|
||||
const streamId = res.data.data?.stream_id;
|
||||
|
||||
if (streamId) {
|
||||
streamChat(streamId)
|
||||
}
|
||||
}).catch((err) => {
|
||||
// if 409
|
||||
if (err.response.status == 409) {
|
||||
const streamId = err.response.data.data?.stream_id
|
||||
|
||||
if (streamId) {
|
||||
streamChat(streamId)
|
||||
}
|
||||
streamChat(streamId);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
// if 409
|
||||
if (err.response.status == 409) {
|
||||
const streamId = err.response.data.data?.stream_id;
|
||||
|
||||
if (streamId) {
|
||||
streamChat(streamId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function streamChat(streamId: String) {
|
||||
const url = conf.basePath + "/api/v1/stream/" + streamId
|
||||
const url = conf.basePath + "/api/v1/stream/" + streamId;
|
||||
|
||||
const evtSource = new EventSource(url)
|
||||
const evtSource = new EventSource(url);
|
||||
|
||||
const newMessage = {
|
||||
content: "",
|
||||
role: "assistant",
|
||||
}
|
||||
};
|
||||
|
||||
if (messages.value.data == null) {
|
||||
messages.value.data = [newMessage]
|
||||
messages.value.data = [newMessage];
|
||||
} else {
|
||||
// add to messages
|
||||
messages.value.data?.push(newMessage)
|
||||
messages.value.data?.push(newMessage);
|
||||
}
|
||||
|
||||
// 滚动页面到最底部
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
|
||||
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
|
||||
// set index
|
||||
let i = (messages.value.data?.length ?? 1) - 1
|
||||
console.log(i)
|
||||
let i = (messages.value.data?.length ?? 1) - 1;
|
||||
console.log(i);
|
||||
|
||||
evtSource.addEventListener("data", (e) => {
|
||||
const data = JSON.parse(e.data)
|
||||
const data = JSON.parse(e.data);
|
||||
|
||||
if (data.state == "tool_calling") {
|
||||
toolName.value = data.tool_call_message.name
|
||||
toolName.value = data.tool_call_message.name;
|
||||
} else if (data.state == "tool_response") {
|
||||
setTimeout(() => {
|
||||
toolName.value = ""
|
||||
|
||||
}, 300)
|
||||
toolName.value = "";
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
messages.value.data[i].content += data.content
|
||||
|
||||
})
|
||||
messages.value.data[i].content += data.content;
|
||||
});
|
||||
|
||||
// close
|
||||
evtSource.addEventListener("close", (e) => {
|
||||
evtSource.close()
|
||||
})
|
||||
evtSource.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
let getMessages = () => {
|
||||
api.ChatMessage.apiV1ChatsIdMessagesGet(chatId).then((res) => {
|
||||
messages.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
getMessages()
|
||||
messages.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
getMessages();
|
||||
</script>
|
@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<h3>工具</h3>
|
||||
|
||||
<v-btn color="primary" @click="to('/tools/create')" class="mt-3 mb-3">创建工具</v-btn>
|
||||
<v-btn color="primary" @click="to('/tools/create')" class="mt-3 mb-3"
|
||||
>创建工具</v-btn
|
||||
>
|
||||
|
||||
<div class="mt-3">
|
||||
<v-row>
|
||||
@ -52,7 +54,9 @@
|
||||
<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-btn color="green darken-1" @click="failedDialog.show = false"
|
||||
>关闭</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
@ -25,7 +25,7 @@ export const useAppStore = defineStore("app", {
|
||||
icon: "mdi-web",
|
||||
text: "联通测试",
|
||||
to: "/ping",
|
||||
}
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ApiV1ChatsGet200Response } from "@/api"
|
||||
import { defineStore } from "pinia"
|
||||
import { api } from "@/plugins/api"
|
||||
import { ApiV1ChatsGet200Response } from "@/api";
|
||||
import { defineStore } from "pinia";
|
||||
import { api } from "@/plugins/api";
|
||||
|
||||
export const useChatStore = defineStore("chats", {
|
||||
state: () => ({
|
||||
@ -13,8 +13,8 @@ export const useChatStore = defineStore("chats", {
|
||||
actions: {
|
||||
getChats() {
|
||||
api.Chat.apiV1ChatsGet().then((response) => {
|
||||
this.chats = response.data
|
||||
})
|
||||
this.chats = response.data;
|
||||
});
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
@ -5,5 +5,4 @@ module.exports = {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user