This commit is contained in:
parent
8775a1abf2
commit
d0346533a0
115
api/swagger.yaml
115
api/swagger.yaml
@ -7,6 +7,10 @@ definitions:
|
||||
type: string
|
||||
disable_default_prompt:
|
||||
type: boolean
|
||||
disable_memory:
|
||||
type: boolean
|
||||
enable_memory_for_assistant_share:
|
||||
type: boolean
|
||||
id:
|
||||
example: "0"
|
||||
type: string
|
||||
@ -53,24 +57,6 @@ definitions:
|
||||
updated_at:
|
||||
type: string
|
||||
type: object
|
||||
entity.AssistantToolType:
|
||||
properties:
|
||||
assistant:
|
||||
$ref: '#/definitions/entity.Assistant'
|
||||
assistant_id:
|
||||
type: integer
|
||||
created_at:
|
||||
type: string
|
||||
id:
|
||||
example: "0"
|
||||
type: string
|
||||
tool:
|
||||
$ref: '#/definitions/entity.Tool'
|
||||
tool_id:
|
||||
type: integer
|
||||
updated_at:
|
||||
type: string
|
||||
type: object
|
||||
entity.Chat:
|
||||
properties:
|
||||
assistant_id:
|
||||
@ -91,7 +77,6 @@ definitions:
|
||||
updated_at:
|
||||
type: string
|
||||
user_id:
|
||||
description: Assistant Assistant `json:"assistant"`
|
||||
type: integer
|
||||
type: object
|
||||
entity.ChatMessage:
|
||||
@ -147,6 +132,20 @@ definitions:
|
||||
url_hash:
|
||||
type: string
|
||||
type: object
|
||||
entity.Memory:
|
||||
properties:
|
||||
content:
|
||||
type: string
|
||||
created_at:
|
||||
type: string
|
||||
id:
|
||||
example: "0"
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
user_id:
|
||||
type: integer
|
||||
type: object
|
||||
entity.Tool:
|
||||
properties:
|
||||
api_key:
|
||||
@ -221,6 +220,16 @@ definitions:
|
||||
- true
|
||||
- false
|
||||
type: boolean
|
||||
disable_memory:
|
||||
enum:
|
||||
- true
|
||||
- false
|
||||
type: boolean
|
||||
enable_memory_for_assistant_share:
|
||||
enum:
|
||||
- true
|
||||
- false
|
||||
type: boolean
|
||||
name:
|
||||
maxLength: 255
|
||||
type: string
|
||||
@ -806,7 +815,7 @@ paths:
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/entity.AssistantToolType'
|
||||
$ref: '#/definitions/entity.AssistantTool'
|
||||
type: array
|
||||
type: object
|
||||
"500":
|
||||
@ -1445,6 +1454,72 @@ paths:
|
||||
summary: 下载文件
|
||||
tags:
|
||||
- file
|
||||
/api/v1/memories:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/entity.Memory'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取所有的记忆
|
||||
tags:
|
||||
- memoires
|
||||
/api/v1/memories/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 删除指定的记忆
|
||||
tags:
|
||||
- memoires
|
||||
/api/v1/memories/purge:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/schema.ResponseBody'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 删除全部记忆
|
||||
tags:
|
||||
- memoires
|
||||
/api/v1/ping:
|
||||
get:
|
||||
consumes:
|
||||
|
388
src/api/api.ts
388
src/api/api.ts
@ -124,10 +124,10 @@ export interface ApiV1AssistantsIdSharesPost200Response {
|
||||
export interface ApiV1AssistantsIdToolsGet200Response {
|
||||
/**
|
||||
*
|
||||
* @type {Array<EntityAssistantToolType>}
|
||||
* @type {Array<EntityAssistantTool>}
|
||||
* @memberof ApiV1AssistantsIdToolsGet200Response
|
||||
*/
|
||||
'data'?: Array<EntityAssistantToolType>;
|
||||
'data'?: Array<EntityAssistantTool>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -383,6 +383,37 @@ export interface ApiV1ChatsIdImagesPostRequest {
|
||||
*/
|
||||
'image'?: File;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface ApiV1MemoriesGet200Response
|
||||
*/
|
||||
export interface ApiV1MemoriesGet200Response {
|
||||
/**
|
||||
*
|
||||
* @type {EntityMemory}
|
||||
* @memberof ApiV1MemoriesGet200Response
|
||||
*/
|
||||
'data'?: EntityMemory;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ApiV1MemoriesGet200Response
|
||||
*/
|
||||
'error'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ApiV1MemoriesGet200Response
|
||||
*/
|
||||
'message'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ApiV1MemoriesGet200Response
|
||||
*/
|
||||
'success'?: boolean;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -500,6 +531,18 @@ export interface EntityAssistant {
|
||||
* @memberof EntityAssistant
|
||||
*/
|
||||
'disable_default_prompt'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof EntityAssistant
|
||||
*/
|
||||
'disable_memory'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof EntityAssistant
|
||||
*/
|
||||
'enable_memory_for_assistant_share'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -623,55 +666,6 @@ export interface EntityAssistantTool {
|
||||
*/
|
||||
'updated_at'?: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface EntityAssistantToolType
|
||||
*/
|
||||
export interface EntityAssistantToolType {
|
||||
/**
|
||||
*
|
||||
* @type {EntityAssistant}
|
||||
* @memberof EntityAssistantToolType
|
||||
*/
|
||||
'assistant'?: EntityAssistant;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityAssistantToolType
|
||||
*/
|
||||
'assistant_id'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityAssistantToolType
|
||||
*/
|
||||
'created_at'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityAssistantToolType
|
||||
*/
|
||||
'id'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {EntityTool}
|
||||
* @memberof EntityAssistantToolType
|
||||
*/
|
||||
'tool'?: EntityTool;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityAssistantToolType
|
||||
*/
|
||||
'tool_id'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityAssistantToolType
|
||||
*/
|
||||
'updated_at'?: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -727,7 +721,7 @@ export interface EntityChat {
|
||||
*/
|
||||
'updated_at'?: string;
|
||||
/**
|
||||
* Assistant Assistant `json:\"assistant\"`
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityChat
|
||||
*/
|
||||
@ -873,6 +867,43 @@ export interface EntityFile {
|
||||
*/
|
||||
'url_hash'?: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface EntityMemory
|
||||
*/
|
||||
export interface EntityMemory {
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityMemory
|
||||
*/
|
||||
'content'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityMemory
|
||||
*/
|
||||
'created_at'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityMemory
|
||||
*/
|
||||
'id'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof EntityMemory
|
||||
*/
|
||||
'updated_at'?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof EntityMemory
|
||||
*/
|
||||
'user_id'?: number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -1025,6 +1056,18 @@ export interface SchemaAssistantUpdateRequest {
|
||||
* @memberof SchemaAssistantUpdateRequest
|
||||
*/
|
||||
'disable_default_prompt'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof SchemaAssistantUpdateRequest
|
||||
*/
|
||||
'disable_memory'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof SchemaAssistantUpdateRequest
|
||||
*/
|
||||
'enable_memory_for_assistant_share'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -3861,6 +3904,247 @@ export class FileApi extends BaseAPI {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* MemoiresApi - axios parameter creator
|
||||
* @export
|
||||
*/
|
||||
export const MemoiresApiAxiosParamCreator = function (configuration?: Configuration) {
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 获取所有的记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiV1MemoriesGet: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/v1/memories`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication ApiKeyAuth required
|
||||
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
||||
|
||||
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除指定的记忆
|
||||
* @param {number} id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiV1MemoriesIdDelete: async (id: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'id' is not null or undefined
|
||||
assertParamExists('apiV1MemoriesIdDelete', 'id', id)
|
||||
const localVarPath = `/api/v1/memories/{id}`
|
||||
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication ApiKeyAuth required
|
||||
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
||||
|
||||
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除全部记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiV1MemoriesPurgePost: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/v1/memories/purge`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication ApiKeyAuth required
|
||||
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
||||
|
||||
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* MemoiresApi - functional programming interface
|
||||
* @export
|
||||
*/
|
||||
export const MemoiresApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = MemoiresApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 获取所有的记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiV1MemoriesGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiV1MemoriesGet200Response>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1MemoriesGet(options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['MemoiresApi.apiV1MemoriesGet']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除指定的记忆
|
||||
* @param {number} id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiV1MemoriesIdDelete(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1MemoriesIdDelete(id, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['MemoiresApi.apiV1MemoriesIdDelete']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除全部记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiV1MemoriesPurgePost(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1MemoriesPurgePost(options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['MemoiresApi.apiV1MemoriesPurgePost']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* MemoiresApi - factory interface
|
||||
* @export
|
||||
*/
|
||||
export const MemoiresApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = MemoiresApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 获取所有的记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiV1MemoriesGet(options?: any): AxiosPromise<ApiV1MemoriesGet200Response> {
|
||||
return localVarFp.apiV1MemoriesGet(options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除指定的记忆
|
||||
* @param {number} id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiV1MemoriesIdDelete(id: number, options?: any): AxiosPromise<void> {
|
||||
return localVarFp.apiV1MemoriesIdDelete(id, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除全部记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiV1MemoriesPurgePost(options?: any): AxiosPromise<void> {
|
||||
return localVarFp.apiV1MemoriesPurgePost(options).then((request) => request(axios, basePath));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* MemoiresApi - object-oriented interface
|
||||
* @export
|
||||
* @class MemoiresApi
|
||||
* @extends {BaseAPI}
|
||||
*/
|
||||
export class MemoiresApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 获取所有的记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof MemoiresApi
|
||||
*/
|
||||
public apiV1MemoriesGet(options?: RawAxiosRequestConfig) {
|
||||
return MemoiresApiFp(this.configuration).apiV1MemoriesGet(options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary 删除指定的记忆
|
||||
* @param {number} id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof MemoiresApi
|
||||
*/
|
||||
public apiV1MemoriesIdDelete(id: number, options?: RawAxiosRequestConfig) {
|
||||
return MemoiresApiFp(this.configuration).apiV1MemoriesIdDelete(id, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary 删除全部记忆
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof MemoiresApi
|
||||
*/
|
||||
public apiV1MemoriesPurgePost(options?: RawAxiosRequestConfig) {
|
||||
return MemoiresApiFp(this.configuration).apiV1MemoriesPurgePost(options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PingApi - axios parameter creator
|
||||
* @export
|
||||
|
@ -44,7 +44,7 @@ import { api } from "@/plugins/api";
|
||||
import {
|
||||
ApiV1AssistantsPost200Response,
|
||||
ApiV1ChatPublicGet200Response,
|
||||
RagNewInternalSchemaChatCreateRequest,
|
||||
SchemaChatCreateRequest,
|
||||
} from "@/api";
|
||||
import router from "@/router";
|
||||
import { useChatStore } from "../../../stores/chat";
|
||||
@ -54,7 +54,7 @@ const assistant: Ref<ApiV1AssistantsPost200Response> = ref({});
|
||||
const chats = ref<ApiV1ChatPublicGet200Response>({});
|
||||
|
||||
const dialog = ref(false);
|
||||
const chat: Ref<RagNewInternalSchemaChatCreateRequest> = ref({
|
||||
const chat: Ref<SchemaChatCreateRequest> = ref({
|
||||
name: "",
|
||||
assistant_id: Number(assistantId),
|
||||
});
|
||||
|
@ -30,6 +30,17 @@
|
||||
v-model="assistant.data.disable_default_prompt"
|
||||
label="禁用默认 Prompt(默认 Prompt 里面包含了用户信息和助理名称等,禁用可以减少 Token 消耗,但是您可能需要做更多的自定义操作)"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-if="assistant.data != null"
|
||||
v-model="assistant.data.disable_memory"
|
||||
label="禁用记忆功能(记忆不是上下文。Amber 将会学习你的对话,让大模型的输出更加贴合你。禁用将不会收集,并且能减少 Token 消耗)"
|
||||
></v-checkbox>
|
||||
|
||||
<v-checkbox
|
||||
v-if="assistant.data != null"
|
||||
v-model="assistant.data.enable_memory_for_assistant_share"
|
||||
label="为访客对话和 OpenAI 兼容格式调用启用记忆(将学习到的记忆应用于任何地方,可能会泄露您的隐私)"
|
||||
></v-checkbox>
|
||||
|
||||
<v-btn color="primary" @click="updateAssistant">编辑</v-btn>
|
||||
|
||||
@ -102,7 +113,7 @@ import {
|
||||
ApiV1AssistantsIdToolsGet200Response,
|
||||
ApiV1AssistantsPost200Response,
|
||||
ApiV1ToolsGet200Response,
|
||||
RagNewInternalSchemaAssistantUpdateRequest,
|
||||
SchemaAssistantUpdateRequest,
|
||||
} from "@/api";
|
||||
|
||||
// @ts-ignore
|
||||
@ -113,6 +124,8 @@ const assistant: Ref<ApiV1AssistantsPost200Response> = ref({
|
||||
description: "",
|
||||
prompt: "",
|
||||
disable_default_prompt: false,
|
||||
disable_memory: false,
|
||||
enable_memory_for_assistant_share: false,
|
||||
},
|
||||
});
|
||||
|
||||
@ -157,7 +170,7 @@ function refresh() {
|
||||
getBindedTools();
|
||||
}
|
||||
|
||||
function bindTool(toolId: Number | undefined) {
|
||||
function bindTool(toolId: Number | String | undefined) {
|
||||
api.Assistant.apiV1AssistantsIdToolsToolIdPost(assistantId, Number(toolId))
|
||||
.then(() => {
|
||||
refresh();
|
||||
@ -169,11 +182,14 @@ function bindTool(toolId: Number | undefined) {
|
||||
}
|
||||
|
||||
function updateAssistant() {
|
||||
const assistantUpdate: RagNewInternalSchemaAssistantUpdateRequest = {
|
||||
const assistantUpdate: SchemaAssistantUpdateRequest = {
|
||||
description: assistant.value.data?.description,
|
||||
name: assistant.value.data?.name,
|
||||
prompt: assistant.value.data?.prompt,
|
||||
disable_default_prompt: assistant.value.data?.disable_default_prompt,
|
||||
disable_memory: assistant.value.data?.disable_memory,
|
||||
enable_memory_for_assistant_share:
|
||||
assistant.value.data?.enable_memory_for_assistant_share,
|
||||
};
|
||||
api.Assistant.apiV1AssistantsIdPatch(assistantId, assistantUpdate);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RagNewInternalSchemaToolDiscoveryInput } from "@/api";
|
||||
import { SchemaToolDiscoveryInput } from "@/api";
|
||||
import { api } from "@/plugins/api";
|
||||
|
||||
const exampleJSON = {
|
||||
@ -64,7 +64,7 @@ function validate() {
|
||||
}
|
||||
|
||||
// 强制类型转换
|
||||
const data: RagNewInternalSchemaToolDiscoveryInput = JSON.parse(input.value);
|
||||
const data: SchemaToolDiscoveryInput = JSON.parse(input.value);
|
||||
|
||||
api.Tool.apiV1ToolsSyntaxPost(data)
|
||||
.then(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user