"代码更新:确保在flush=false时,重新加载时不会刷新新实体。此修复遵循指定的flush
参数,以前新实体实例会刷新,现在只有在flush=true
时才会刷新。"
This commit is contained in:
parent
54bef3d8e5
commit
9b39c1a5e7
1088
api/swagger.yaml
1088
api/swagger.yaml
File diff suppressed because it is too large
Load Diff
6637
src/api/api.ts
6637
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";
|
||||||
|
|
||||||
|
424
src/auto-imports.d.ts
vendored
424
src/auto-imports.d.ts
vendored
@ -5,271 +5,187 @@
|
|||||||
// Generated by unplugin-auto-import
|
// Generated by unplugin-auto-import
|
||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
const EffectScope: (typeof import("vue"))["EffectScope"];
|
const EffectScope: typeof import('vue')['EffectScope']
|
||||||
const computed: (typeof import("vue"))["computed"];
|
const computed: typeof import('vue')['computed']
|
||||||
const createApp: (typeof import("vue"))["createApp"];
|
const createApp: typeof import('vue')['createApp']
|
||||||
const customRef: (typeof import("vue"))["customRef"];
|
const customRef: typeof import('vue')['customRef']
|
||||||
const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"];
|
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||||
const defineComponent: (typeof import("vue"))["defineComponent"];
|
const defineComponent: typeof import('vue')['defineComponent']
|
||||||
const effectScope: (typeof import("vue"))["effectScope"];
|
const effectScope: typeof import('vue')['effectScope']
|
||||||
const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"];
|
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||||
const getCurrentScope: (typeof import("vue"))["getCurrentScope"];
|
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||||
const h: (typeof import("vue"))["h"];
|
const h: typeof import('vue')['h']
|
||||||
const inject: (typeof import("vue"))["inject"];
|
const inject: typeof import('vue')['inject']
|
||||||
const isProxy: (typeof import("vue"))["isProxy"];
|
const isProxy: typeof import('vue')['isProxy']
|
||||||
const isReactive: (typeof import("vue"))["isReactive"];
|
const isReactive: typeof import('vue')['isReactive']
|
||||||
const isReadonly: (typeof import("vue"))["isReadonly"];
|
const isReadonly: typeof import('vue')['isReadonly']
|
||||||
const isRef: (typeof import("vue"))["isRef"];
|
const isRef: typeof import('vue')['isRef']
|
||||||
const markRaw: (typeof import("vue"))["markRaw"];
|
const markRaw: typeof import('vue')['markRaw']
|
||||||
const nextTick: (typeof import("vue"))["nextTick"];
|
const nextTick: typeof import('vue')['nextTick']
|
||||||
const onActivated: (typeof import("vue"))["onActivated"];
|
const onActivated: typeof import('vue')['onActivated']
|
||||||
const onBeforeMount: (typeof import("vue"))["onBeforeMount"];
|
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||||
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"];
|
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"]
|
||||||
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"];
|
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"]
|
||||||
const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"];
|
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||||
const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"];
|
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||||
const onDeactivated: (typeof import("vue"))["onDeactivated"];
|
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||||
const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"];
|
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||||
const onMounted: (typeof import("vue"))["onMounted"];
|
const onMounted: typeof import('vue')['onMounted']
|
||||||
const onRenderTracked: (typeof import("vue"))["onRenderTracked"];
|
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||||
const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"];
|
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||||
const onScopeDispose: (typeof import("vue"))["onScopeDispose"];
|
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||||
const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"];
|
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||||
const onUnmounted: (typeof import("vue"))["onUnmounted"];
|
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||||
const onUpdated: (typeof import("vue"))["onUpdated"];
|
const onUpdated: typeof import('vue')['onUpdated']
|
||||||
const provide: (typeof import("vue"))["provide"];
|
const provide: typeof import('vue')['provide']
|
||||||
const reactive: (typeof import("vue"))["reactive"];
|
const reactive: typeof import('vue')['reactive']
|
||||||
const readonly: (typeof import("vue"))["readonly"];
|
const readonly: typeof import('vue')['readonly']
|
||||||
const ref: (typeof import("vue"))["ref"];
|
const ref: typeof import('vue')['ref']
|
||||||
const resolveComponent: (typeof import("vue"))["resolveComponent"];
|
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||||
const shallowReactive: (typeof import("vue"))["shallowReactive"];
|
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||||
const shallowReadonly: (typeof import("vue"))["shallowReadonly"];
|
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||||
const shallowRef: (typeof import("vue"))["shallowRef"];
|
const shallowRef: typeof import('vue')['shallowRef']
|
||||||
const toRaw: (typeof import("vue"))["toRaw"];
|
const toRaw: typeof import('vue')['toRaw']
|
||||||
const toRef: (typeof import("vue"))["toRef"];
|
const toRef: typeof import('vue')['toRef']
|
||||||
const toRefs: (typeof import("vue"))["toRefs"];
|
const toRefs: typeof import('vue')['toRefs']
|
||||||
const toValue: (typeof import("vue"))["toValue"];
|
const toValue: typeof import('vue')['toValue']
|
||||||
const triggerRef: (typeof import("vue"))["triggerRef"];
|
const triggerRef: typeof import('vue')['triggerRef']
|
||||||
const unref: (typeof import("vue"))["unref"];
|
const unref: typeof import('vue')['unref']
|
||||||
const useAttrs: (typeof import("vue"))["useAttrs"];
|
const useAttrs: typeof import('vue')['useAttrs']
|
||||||
const useCssModule: (typeof import("vue"))["useCssModule"];
|
const useCssModule: typeof import('vue')['useCssModule']
|
||||||
const useCssVars: (typeof import("vue"))["useCssVars"];
|
const useCssVars: typeof import('vue')['useCssVars']
|
||||||
const useLink: (typeof import("vue-router"))["useLink"];
|
const useLink: (typeof import("vue-router"))["useLink"]
|
||||||
const useRoute: (typeof import("vue-router/auto"))["useRoute"];
|
const useRoute: typeof import('vue-router/auto')['useRoute']
|
||||||
const useRouter: (typeof import("vue-router/auto"))["useRouter"];
|
const useRouter: typeof import('vue-router/auto')['useRouter']
|
||||||
const useSlots: (typeof import("vue"))["useSlots"];
|
const useSlots: typeof import('vue')['useSlots']
|
||||||
const watch: (typeof import("vue"))["watch"];
|
const watch: typeof import('vue')['watch']
|
||||||
const watchEffect: (typeof import("vue"))["watchEffect"];
|
const watchEffect: typeof import('vue')['watchEffect']
|
||||||
const watchPostEffect: (typeof import("vue"))["watchPostEffect"];
|
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||||
const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"];
|
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||||
}
|
}
|
||||||
// for type re-export
|
// for type re-export
|
||||||
declare global {
|
declare global {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export type {
|
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
|
||||||
Component,
|
import('vue')
|
||||||
ComponentPublicInstance,
|
|
||||||
ComputedRef,
|
|
||||||
ExtractDefaultPropTypes,
|
|
||||||
ExtractPropTypes,
|
|
||||||
ExtractPublicPropTypes,
|
|
||||||
InjectionKey,
|
|
||||||
PropType,
|
|
||||||
Ref,
|
|
||||||
VNode,
|
|
||||||
WritableComputedRef,
|
|
||||||
} from "vue";
|
|
||||||
import("vue");
|
|
||||||
}
|
}
|
||||||
// for vue template auto import
|
// for vue template auto import
|
||||||
import { UnwrapRef } from "vue";
|
import { UnwrapRef } from 'vue'
|
||||||
declare module "vue" {
|
declare module 'vue' {
|
||||||
interface GlobalComponents {}
|
interface GlobalComponents {}
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>;
|
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||||
readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>;
|
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||||
readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>;
|
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||||
readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>;
|
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||||
readonly defineAsyncComponent: UnwrapRef<
|
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
|
||||||
(typeof import("vue"))["defineAsyncComponent"]
|
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
|
||||||
>;
|
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
||||||
readonly defineComponent: UnwrapRef<
|
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
||||||
(typeof import("vue"))["defineComponent"]
|
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
||||||
>;
|
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||||
readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>;
|
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||||
readonly getCurrentInstance: UnwrapRef<
|
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||||
(typeof import("vue"))["getCurrentInstance"]
|
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||||
>;
|
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
|
||||||
readonly getCurrentScope: UnwrapRef<
|
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
|
||||||
(typeof import("vue"))["getCurrentScope"]
|
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
|
||||||
>;
|
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
|
||||||
readonly h: UnwrapRef<(typeof import("vue"))["h"]>;
|
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
|
||||||
readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>;
|
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
|
||||||
readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>;
|
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
|
||||||
readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>;
|
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
|
||||||
readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>;
|
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
|
||||||
readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>;
|
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
|
||||||
readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>;
|
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
|
||||||
readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>;
|
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
|
||||||
readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>;
|
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
|
||||||
readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>;
|
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
|
||||||
readonly onBeforeUnmount: UnwrapRef<
|
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
|
||||||
(typeof import("vue"))["onBeforeUnmount"]
|
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
||||||
>;
|
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||||
readonly onBeforeUpdate: UnwrapRef<
|
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||||
(typeof import("vue"))["onBeforeUpdate"]
|
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||||
>;
|
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
|
||||||
readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>;
|
readonly ref: UnwrapRef<typeof import('vue')['ref']>
|
||||||
readonly onErrorCaptured: UnwrapRef<
|
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
|
||||||
(typeof import("vue"))["onErrorCaptured"]
|
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
|
||||||
>;
|
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
|
||||||
readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>;
|
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
|
||||||
readonly onRenderTracked: UnwrapRef<
|
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
|
||||||
(typeof import("vue"))["onRenderTracked"]
|
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
|
||||||
>;
|
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
|
||||||
readonly onRenderTriggered: UnwrapRef<
|
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
|
||||||
(typeof import("vue"))["onRenderTriggered"]
|
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
|
||||||
>;
|
readonly unref: UnwrapRef<typeof import('vue')['unref']>
|
||||||
readonly onScopeDispose: UnwrapRef<
|
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
|
||||||
(typeof import("vue"))["onScopeDispose"]
|
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
||||||
>;
|
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||||
readonly onServerPrefetch: UnwrapRef<
|
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
|
||||||
(typeof import("vue"))["onServerPrefetch"]
|
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
|
||||||
>;
|
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
||||||
readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>;
|
readonly watch: UnwrapRef<typeof import('vue')['watch']>
|
||||||
readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>;
|
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
|
||||||
readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>;
|
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
|
||||||
readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>;
|
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
|
||||||
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 GlobalComponents {}
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>;
|
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||||
readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>;
|
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||||
readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>;
|
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||||
readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>;
|
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||||
readonly defineAsyncComponent: UnwrapRef<
|
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
|
||||||
(typeof import("vue"))["defineAsyncComponent"]
|
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
|
||||||
>;
|
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
||||||
readonly defineComponent: UnwrapRef<
|
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
||||||
(typeof import("vue"))["defineComponent"]
|
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
||||||
>;
|
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||||
readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>;
|
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||||
readonly getCurrentInstance: UnwrapRef<
|
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||||
(typeof import("vue"))["getCurrentInstance"]
|
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||||
>;
|
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
|
||||||
readonly getCurrentScope: UnwrapRef<
|
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
|
||||||
(typeof import("vue"))["getCurrentScope"]
|
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
|
||||||
>;
|
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
|
||||||
readonly h: UnwrapRef<(typeof import("vue"))["h"]>;
|
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
|
||||||
readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>;
|
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
|
||||||
readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>;
|
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
|
||||||
readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>;
|
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
|
||||||
readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>;
|
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
|
||||||
readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>;
|
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
|
||||||
readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>;
|
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
|
||||||
readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>;
|
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
|
||||||
readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>;
|
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
|
||||||
readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>;
|
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
|
||||||
readonly onBeforeUnmount: UnwrapRef<
|
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
|
||||||
(typeof import("vue"))["onBeforeUnmount"]
|
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
||||||
>;
|
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||||
readonly onBeforeUpdate: UnwrapRef<
|
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||||
(typeof import("vue"))["onBeforeUpdate"]
|
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||||
>;
|
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
|
||||||
readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>;
|
readonly ref: UnwrapRef<typeof import('vue')['ref']>
|
||||||
readonly onErrorCaptured: UnwrapRef<
|
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
|
||||||
(typeof import("vue"))["onErrorCaptured"]
|
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
|
||||||
>;
|
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
|
||||||
readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>;
|
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
|
||||||
readonly onRenderTracked: UnwrapRef<
|
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
|
||||||
(typeof import("vue"))["onRenderTracked"]
|
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
|
||||||
>;
|
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
|
||||||
readonly onRenderTriggered: UnwrapRef<
|
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
|
||||||
(typeof import("vue"))["onRenderTriggered"]
|
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
|
||||||
>;
|
readonly unref: UnwrapRef<typeof import('vue')['unref']>
|
||||||
readonly onScopeDispose: UnwrapRef<
|
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
|
||||||
(typeof import("vue"))["onScopeDispose"]
|
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
||||||
>;
|
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||||
readonly onServerPrefetch: UnwrapRef<
|
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
|
||||||
(typeof import("vue"))["onServerPrefetch"]
|
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
|
||||||
>;
|
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
||||||
readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>;
|
readonly watch: UnwrapRef<typeof import('vue')['watch']>
|
||||||
readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>;
|
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
|
||||||
readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>;
|
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
|
||||||
readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>;
|
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
|
||||||
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"]
|
|
||||||
>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,13 @@
|
|||||||
</v-avatar>
|
</v-avatar>
|
||||||
</template>
|
</template>
|
||||||
<v-list-item-title>{{ c.name }}</v-list-item-title>
|
<v-list-item-title>{{ c.name }}</v-list-item-title>
|
||||||
<v-list-item-subtitle>{{ c.created_at }}</v-list-item-subtitle>
|
<v-list-item-subtitle>
|
||||||
|
<span>{{ c.created_at }}</span>
|
||||||
|
|
||||||
|
<span v-if="c.owner == 'guest'">访客对话</span>
|
||||||
|
<span v-else-if="c.owner == 'user'">用户对话</span>
|
||||||
|
<span v-else>{{ c.owner }}</span>
|
||||||
|
</v-list-item-subtitle>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-slide-y-transition>
|
</v-slide-y-transition>
|
||||||
</div>
|
</div>
|
||||||
@ -37,7 +43,7 @@ import { ref } from "vue";
|
|||||||
import { api } from "@/plugins/api";
|
import { api } from "@/plugins/api";
|
||||||
import {
|
import {
|
||||||
ApiV1AssistantsPost200Response,
|
ApiV1AssistantsPost200Response,
|
||||||
ApiV1ChatsGet200Response,
|
ApiV1ChatPublicGet200Response,
|
||||||
RagNewInternalSchemaChatCreateRequest,
|
RagNewInternalSchemaChatCreateRequest,
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
@ -45,7 +51,7 @@ import { useChatStore } from "../../../stores/chat";
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const assistantId = router.currentRoute.value.params.id as number;
|
const assistantId = router.currentRoute.value.params.id as number;
|
||||||
const assistant: Ref<ApiV1AssistantsPost200Response> = ref({});
|
const assistant: Ref<ApiV1AssistantsPost200Response> = ref({});
|
||||||
const chats = ref<ApiV1ChatsGet200Response>({});
|
const chats = ref<ApiV1ChatPublicGet200Response>({});
|
||||||
|
|
||||||
const dialog = ref(false);
|
const dialog = ref(false);
|
||||||
const chat: Ref<RagNewInternalSchemaChatCreateRequest> = ref({
|
const chat: Ref<RagNewInternalSchemaChatCreateRequest> = ref({
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<h3>助理 {{ assistant.data?.name }}</h3>
|
<h3>助理 {{ assistant.data?.name }}</h3>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<v-btn color="primary" @click="to('/assistants/' + assistantId + '/shares')"
|
||||||
|
>公开发布助理</v-btn
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-if="assistant.data != null"
|
v-if="assistant.data != null"
|
||||||
v-model="assistant.data.name"
|
v-model="assistant.data.name"
|
||||||
@ -164,5 +170,9 @@ function updateAssistant() {
|
|||||||
api.Assistant.apiV1AssistantsIdPatch(assistantId, assistantUpdate);
|
api.Assistant.apiV1AssistantsIdPatch(assistantId, assistantUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function to(path: string) {
|
||||||
|
router.push(path);
|
||||||
|
}
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
</script>
|
</script>
|
||||||
|
91
src/pages/assistants/[id]/shares.vue
Normal file
91
src/pages/assistants/[id]/shares.vue
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<template>
|
||||||
|
<h3>共享助理 {{ assistant.data?.name }}</h3>
|
||||||
|
|
||||||
|
<v-btn color="primary" @click="createShare">创建共享</v-btn>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<p class="mb-3">共享列表</p>
|
||||||
|
<v-row>
|
||||||
|
<v-col
|
||||||
|
v-for="s in assistantShares.data"
|
||||||
|
:key="s.id"
|
||||||
|
cols="12"
|
||||||
|
md="4"
|
||||||
|
sm="6"
|
||||||
|
>
|
||||||
|
<v-card>
|
||||||
|
<v-card-text>
|
||||||
|
<p>Api Key: {{ s.token }}</p>
|
||||||
|
</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-btn color="primary" @click="goto(s.token ?? 0)">访问共享</v-btn>
|
||||||
|
<v-btn color="error" @click="deleteShare(s.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 {
|
||||||
|
ApiV1AssistantsIdSharesGet200Response,
|
||||||
|
ApiV1AssistantsPost200Response,
|
||||||
|
} from "@/api";
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const assistantId = router.currentRoute.value.params.id as number;
|
||||||
|
const assistant: Ref<ApiV1AssistantsPost200Response> = ref({
|
||||||
|
data: {
|
||||||
|
name: "",
|
||||||
|
description: "",
|
||||||
|
prompt: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const assistantShares: Ref<ApiV1AssistantsIdSharesGet200Response> = ref({});
|
||||||
|
|
||||||
|
function getAssistant() {
|
||||||
|
api.Assistant.apiV1AssistantsIdGet(assistantId).then((res) => {
|
||||||
|
assistant.value = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function getAssistantShare() {
|
||||||
|
api.Assistant.apiV1AssistantsIdSharesGet(assistantId).then((res) => {
|
||||||
|
assistantShares.value = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
getAssistant();
|
||||||
|
getAssistantShare();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createShare() {
|
||||||
|
api.Assistant.apiV1AssistantsIdSharesPost(assistantId).then(() => {
|
||||||
|
getAssistantShare();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteShare(shareId: number) {
|
||||||
|
api.Assistant.apiV1AssistantsIdSharesShareIdDelete(assistantId, shareId).then(
|
||||||
|
() => {
|
||||||
|
getAssistantShare();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function goto(token: any) {
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.target = "_blank";
|
||||||
|
a.href = `/public_chat?assistant_token=${token}`;
|
||||||
|
a.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
</script>
|
@ -69,18 +69,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ApiV1ChatsIdMessagesGet200Response } from "@/api";
|
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { api, conf } from "@/plugins/api";
|
import { api, conf } from "@/plugins/api";
|
||||||
import VueMarkdown from "vue-markdown-render";
|
import VueMarkdown from "vue-markdown-render";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { useChatStore } from "@/stores/chat";
|
import { useChatStore } from "@/stores/chat";
|
||||||
|
import { ApiV1ChatPublicChatIdMessagesGet200Response } from "@/api";
|
||||||
const chatStore = useChatStore();
|
const chatStore = useChatStore();
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const chatId = parseInt(useRoute().params.id as string);
|
const chatId = parseInt(useRoute().params.id as string);
|
||||||
|
|
||||||
const messages: Ref<ApiV1ChatsIdMessagesGet200Response> = ref({
|
const messages: Ref<ApiV1ChatPublicChatIdMessagesGet200Response> = ref({
|
||||||
data: [],
|
data: [],
|
||||||
});
|
});
|
||||||
const input = ref("");
|
const input = ref("");
|
||||||
|
267
src/pages/public_chat/index.vue
Normal file
267
src/pages/public_chat/index.vue
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h3 class="mb-3">聊天记录</h3>
|
||||||
|
|
||||||
|
<v-card
|
||||||
|
v-for="message in messages.data"
|
||||||
|
:key="message.id"
|
||||||
|
class="mx-auto mt-3"
|
||||||
|
width="100%"
|
||||||
|
>
|
||||||
|
<template #title>
|
||||||
|
<div class="font-weight-black">
|
||||||
|
<div v-if="message.role == 'assistant'">AI</div>
|
||||||
|
<div v-else-if="message.role == 'system'">系统</div>
|
||||||
|
|
||||||
|
<div v-else-if="message.role == 'user'" class="text-right">用户</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
{{ message.role }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<v-card-text class="bg-surface-light pt-4">
|
||||||
|
<div
|
||||||
|
v-if="message.role == 'assistant' || message.role == 'system'"
|
||||||
|
class="text-left"
|
||||||
|
>
|
||||||
|
<vue-markdown :source="message.content" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="message.role == 'user'" class="text-right">
|
||||||
|
<vue-markdown :source="message.content" />
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
{{ message.content }}
|
||||||
|
</div>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<div v-if="toolError" class="mb-3">
|
||||||
|
<v-alert
|
||||||
|
density="compact"
|
||||||
|
text="这个工具出现了异常,这应该不是我们的问题,如果你是此工具的开发者,请打开开发者控制台查看具体错误。"
|
||||||
|
:title="'工具 ' + toolName + ' 出现异常'"
|
||||||
|
type="warning"
|
||||||
|
></v-alert>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-show="toolCalling">
|
||||||
|
<v-progress-circular
|
||||||
|
color="primary"
|
||||||
|
indeterminate
|
||||||
|
:size="16"
|
||||||
|
></v-progress-circular>
|
||||||
|
正在执行 {{ toolName }}
|
||||||
|
</div>
|
||||||
|
<v-text-field
|
||||||
|
v-model="input"
|
||||||
|
label="输入消息"
|
||||||
|
@keyup.enter="sendMessage"
|
||||||
|
></v-text-field>
|
||||||
|
<v-btn color="primary" @click="sendMessage">发送</v-btn>
|
||||||
|
<v-btn class="ml-2" color="primary" @click="clearMessages">清空</v-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { api, conf } from "@/plugins/api";
|
||||||
|
import VueMarkdown from "vue-markdown-render";
|
||||||
|
import router from "@/router";
|
||||||
|
import {
|
||||||
|
ApiV1ChatPublicChatIdMessagesGet200Response,
|
||||||
|
RagNewInternalSchemaChatPublicRequest,
|
||||||
|
RagNewInternalSchemaGetPublicChatMessageRequest,
|
||||||
|
} from "@/api";
|
||||||
|
import { usePublicChatStore } from "@/stores/public_chat";
|
||||||
|
|
||||||
|
const publicChatStore = usePublicChatStore();
|
||||||
|
|
||||||
|
if (publicChatStore.guest_id === "") {
|
||||||
|
publicChatStore.generateGuestId();
|
||||||
|
}
|
||||||
|
|
||||||
|
const chatId = ref(0);
|
||||||
|
|
||||||
|
// 获取查询参数
|
||||||
|
const queries = new URLSearchParams(window.location.search);
|
||||||
|
const requiredQuries = ["assistant_token"];
|
||||||
|
|
||||||
|
for (const query of requiredQuries) {
|
||||||
|
if (!queries.has(query)) {
|
||||||
|
router.push("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const messages: Ref<ApiV1ChatPublicChatIdMessagesGet200Response> = ref({
|
||||||
|
data: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
const publicChatInfo: Ref<RagNewInternalSchemaGetPublicChatMessageRequest> =
|
||||||
|
ref({
|
||||||
|
assistant_token: queries.get("assistant_token") as string,
|
||||||
|
guest_id: publicChatStore.guest_id,
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentDate = new Date();
|
||||||
|
|
||||||
|
const publicNewChat: Ref<RagNewInternalSchemaChatPublicRequest> = ref({
|
||||||
|
assistant_token: publicChatInfo.value.assistant_token,
|
||||||
|
name: currentDate.toLocaleDateString() + " 时的对话",
|
||||||
|
guest_id: publicChatStore.guest_id,
|
||||||
|
});
|
||||||
|
|
||||||
|
const input = ref("");
|
||||||
|
const toolName = ref("");
|
||||||
|
const toolError = ref(false);
|
||||||
|
const toolCalling = ref(false);
|
||||||
|
|
||||||
|
function sendMessage() {
|
||||||
|
if (input.value !== "") {
|
||||||
|
toolError.value = false;
|
||||||
|
api.ChatPublic.apiV1ChatPublicChatIdMessagesPost(chatId.value, {
|
||||||
|
message: input.value,
|
||||||
|
assistant_token: publicChatInfo.value.assistant_token,
|
||||||
|
guest_id: publicChatStore.guest_id,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
const newMessage = {
|
||||||
|
content: input.value,
|
||||||
|
role: "user",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (messages.value.data == null) {
|
||||||
|
messages.value.data = [newMessage];
|
||||||
|
} else {
|
||||||
|
messages.value.data?.push(newMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function streamChat(streamId: String) {
|
||||||
|
const url = conf.basePath + "/api/v1/stream/" + streamId;
|
||||||
|
|
||||||
|
const evtSource = new EventSource(url);
|
||||||
|
|
||||||
|
let messageAdded = false;
|
||||||
|
|
||||||
|
// 滚动页面到最底部
|
||||||
|
window.scrollTo(0, document.body.scrollHeight);
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
evtSource.addEventListener("data", (e) => {
|
||||||
|
const data = JSON.parse(e.data);
|
||||||
|
console.log(data.state);
|
||||||
|
|
||||||
|
let append = true;
|
||||||
|
|
||||||
|
switch (data.state) {
|
||||||
|
case "tool_calling":
|
||||||
|
toolCalling.value = true;
|
||||||
|
toolName.value =
|
||||||
|
data.tool_call_message.tool_name +
|
||||||
|
" 中的 " +
|
||||||
|
data.tool_call_message.function_name;
|
||||||
|
break;
|
||||||
|
case "tool_response":
|
||||||
|
setTimeout(() => {
|
||||||
|
toolName.value = "";
|
||||||
|
toolCalling.value = false;
|
||||||
|
}, 300);
|
||||||
|
break;
|
||||||
|
case "tool_failed":
|
||||||
|
toolName.value =
|
||||||
|
data.tool_response_message.tool_name +
|
||||||
|
" 中的 " +
|
||||||
|
data.tool_response_message.function_name;
|
||||||
|
toolError.value = true;
|
||||||
|
append = false;
|
||||||
|
setTimeout(() => {
|
||||||
|
toolCalling.value = false;
|
||||||
|
}, 300);
|
||||||
|
break;
|
||||||
|
case "chunk":
|
||||||
|
if (!messageAdded) {
|
||||||
|
const newMessage = {
|
||||||
|
content: "",
|
||||||
|
role: "assistant",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (messages.value.data == null) {
|
||||||
|
messages.value.data = [newMessage];
|
||||||
|
} else {
|
||||||
|
// add to messages
|
||||||
|
messages.value.data?.push(newMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
messageAdded = true;
|
||||||
|
append = true;
|
||||||
|
// set index
|
||||||
|
i = (messages.value.data?.length ?? 1) - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (append && messageAdded) {
|
||||||
|
// @ts-ignore
|
||||||
|
messages.value.data[i].content += data.content;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// close
|
||||||
|
evtSource.addEventListener("close", () => {
|
||||||
|
evtSource.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const getMessages = () => {
|
||||||
|
api.ChatPublic.apiV1ChatPublicChatIdMessagesGet(
|
||||||
|
chatId.value,
|
||||||
|
publicChatInfo.value.assistant_token,
|
||||||
|
publicChatInfo.value.guest_id,
|
||||||
|
).then((res) => {
|
||||||
|
messages.value = res.data;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearMessages = () => {
|
||||||
|
api.ChatPublic.apiV1ChatPublicChatIdClearPost(
|
||||||
|
chatId.value,
|
||||||
|
publicChatInfo.value,
|
||||||
|
).then(() => {
|
||||||
|
getMessages();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const createChat = () => {
|
||||||
|
api.ChatPublic.apiV1ChatPublicPost(publicNewChat.value).then((res) => {
|
||||||
|
if (res.data.data?.id) {
|
||||||
|
chatId.value = res.data.data.id;
|
||||||
|
}
|
||||||
|
getMessages();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
createChat();
|
||||||
|
</script>
|
@ -2,6 +2,7 @@ import {
|
|||||||
AssistantApi,
|
AssistantApi,
|
||||||
ChatApi,
|
ChatApi,
|
||||||
ChatMessageApi,
|
ChatMessageApi,
|
||||||
|
ChatPublicApi,
|
||||||
Configuration,
|
Configuration,
|
||||||
PingApi,
|
PingApi,
|
||||||
ToolApi,
|
ToolApi,
|
||||||
@ -29,6 +30,7 @@ const api = {
|
|||||||
Ping: new PingApi(conf),
|
Ping: new PingApi(conf),
|
||||||
Tool: new ToolApi(conf),
|
Tool: new ToolApi(conf),
|
||||||
ChatMessage: new ChatMessageApi(conf),
|
ChatMessage: new ChatMessageApi(conf),
|
||||||
|
ChatPublic: new ChatPublicApi(conf),
|
||||||
};
|
};
|
||||||
|
|
||||||
export { api, conf };
|
export { api, conf };
|
||||||
|
13
src/stores/public_chat.ts
Normal file
13
src/stores/public_chat.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const usePublicChatStore = defineStore("public_chat", {
|
||||||
|
persist: true,
|
||||||
|
state: () => ({
|
||||||
|
guest_id: "",
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
generateGuestId() {
|
||||||
|
this.guest_id = Math.random().toString(36).substring(2, 12);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
2
src/typed-router.d.ts
vendored
2
src/typed-router.d.ts
vendored
@ -22,11 +22,13 @@ declare module 'vue-router/auto-routes' {
|
|||||||
'/assistants/': RouteRecordInfo<'/assistants/', '/assistants', Record<never, never>, Record<never, never>>,
|
'/assistants/': RouteRecordInfo<'/assistants/', '/assistants', Record<never, never>, Record<never, never>>,
|
||||||
'/assistants/[id]/chats': RouteRecordInfo<'/assistants/[id]/chats', '/assistants/:id/chats', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
'/assistants/[id]/chats': RouteRecordInfo<'/assistants/[id]/chats', '/assistants/:id/chats', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
'/assistants/[id]/edit': RouteRecordInfo<'/assistants/[id]/edit', '/assistants/:id/edit', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
'/assistants/[id]/edit': RouteRecordInfo<'/assistants/[id]/edit', '/assistants/:id/edit', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
|
'/assistants/[id]/shares': RouteRecordInfo<'/assistants/[id]/shares', '/assistants/:id/shares', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
'/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>>,
|
||||||
'/chats/[id]/': RouteRecordInfo<'/chats/[id]/', '/chats/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
'/chats/[id]/': RouteRecordInfo<'/chats/[id]/', '/chats/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
'/ping/': RouteRecordInfo<'/ping/', '/ping', Record<never, never>, Record<never, never>>,
|
'/ping/': RouteRecordInfo<'/ping/', '/ping', Record<never, never>, Record<never, never>>,
|
||||||
|
'/public_chat/': RouteRecordInfo<'/public_chat/', '/public_chat', Record<never, never>, Record<never, never>>,
|
||||||
'/tools/': RouteRecordInfo<'/tools/', '/tools', 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>>,
|
'/tools/create': RouteRecordInfo<'/tools/create', '/tools/create', Record<never, never>, Record<never, never>>,
|
||||||
'/tools/validate': RouteRecordInfo<'/tools/validate', '/tools/validate', Record<never, never>, Record<never, never>>,
|
'/tools/validate': RouteRecordInfo<'/tools/validate', '/tools/validate', Record<never, never>, Record<never, never>>,
|
||||||
|
Loading…
Reference in New Issue
Block a user