增加 场景提示词设置
This commit is contained in:
parent
9aba890b46
commit
07547899ef
193
api/swagger.yaml
193
api/swagger.yaml
@ -247,6 +247,24 @@ definitions:
|
|||||||
user_id:
|
user_id:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
entity.ScenePrompt:
|
||||||
|
properties:
|
||||||
|
assistant:
|
||||||
|
$ref: '#/definitions/entity.Assistant'
|
||||||
|
assistant_id:
|
||||||
|
type: integer
|
||||||
|
created_at:
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
description: Id schema.EntityId `gorm:"primarykey" json:"id,string"`
|
||||||
|
type: integer
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
prompt:
|
||||||
|
type: string
|
||||||
|
updated_at:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
entity.Tool:
|
entity.Tool:
|
||||||
properties:
|
properties:
|
||||||
api_key:
|
api_key:
|
||||||
@ -269,8 +287,31 @@ definitions:
|
|||||||
user_id:
|
user_id:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
page.PagedResult-entity_ChatMessageList:
|
||||||
|
properties:
|
||||||
|
count:
|
||||||
|
type: integer
|
||||||
|
data:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/entity.ChatMessageList'
|
||||||
|
type: array
|
||||||
|
page:
|
||||||
|
description: 当前页码
|
||||||
|
type: integer
|
||||||
|
page_size:
|
||||||
|
description: 每页大小
|
||||||
|
type: integer
|
||||||
|
total_count:
|
||||||
|
description: 数据总条数
|
||||||
|
type: integer
|
||||||
|
total_pages:
|
||||||
|
description: 总页数
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
page.PagedResult-schema_AssistantPublic:
|
page.PagedResult-schema_AssistantPublic:
|
||||||
properties:
|
properties:
|
||||||
|
count:
|
||||||
|
type: integer
|
||||||
data:
|
data:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/schema.AssistantPublic'
|
$ref: '#/definitions/schema.AssistantPublic'
|
||||||
@ -495,6 +536,18 @@ definitions:
|
|||||||
required:
|
required:
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
|
schema.CreateAssistantScenePromptRequest:
|
||||||
|
properties:
|
||||||
|
label:
|
||||||
|
maxLength: 20
|
||||||
|
type: string
|
||||||
|
prompt:
|
||||||
|
maxLength: 512
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- label
|
||||||
|
- prompt
|
||||||
|
type: object
|
||||||
schema.CurrentUserResponse:
|
schema.CurrentUserResponse:
|
||||||
properties:
|
properties:
|
||||||
ip:
|
ip:
|
||||||
@ -1081,6 +1134,104 @@ paths:
|
|||||||
summary: 绑定资料库
|
summary: 绑定资料库
|
||||||
tags:
|
tags:
|
||||||
- assistant
|
- assistant
|
||||||
|
/api/v1/assistants/{id}/scene_prompts:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/schema.ResponseBody'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/entity.ScenePrompt'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.ResponseBody'
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 列出当前助理的场景 Prompt
|
||||||
|
tags:
|
||||||
|
- assistant
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: CreateAssistantScenePromptRequest
|
||||||
|
in: body
|
||||||
|
name: CreateAssistantScenePromptRequest
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.CreateAssistantScenePromptRequest'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/schema.ResponseBody'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/entity.ScenePrompt'
|
||||||
|
type: object
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.ResponseBody'
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 创建场景 Prompt
|
||||||
|
tags:
|
||||||
|
- assistant
|
||||||
|
/api/v1/assistants/{id}/scene_prompts/{scene_id}:
|
||||||
|
delete:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- in: path
|
||||||
|
name: scene_id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: No Content
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.ResponseBody'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.ResponseBody'
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 删除场景 Prompt
|
||||||
|
tags:
|
||||||
|
- assistant
|
||||||
/api/v1/assistants/{id}/tools:
|
/api/v1/assistants/{id}/tools:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
@ -1920,6 +2071,48 @@ paths:
|
|||||||
summary: 添加聊天记录
|
summary: 添加聊天记录
|
||||||
tags:
|
tags:
|
||||||
- chat_message
|
- chat_message
|
||||||
|
/api/v1/chats/{id}/messages/paginate:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 获取一个对话的所有聊天记录
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- in: query
|
||||||
|
name: page
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/schema.ResponseBody'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/page.PagedResult-entity_ChatMessageList'
|
||||||
|
type: object
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.ResponseBody'
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.ResponseBody'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/schema.ResponseBody'
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 分页获取聊天记录
|
||||||
|
tags:
|
||||||
|
- chat_message
|
||||||
/api/v1/files/download/{hash}:
|
/api/v1/files/download/{hash}:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
|
522
src/api/api.ts
522
src/api/api.ts
@ -147,6 +147,68 @@ export interface ApiV1AssistantsIdKeysPost200Response {
|
|||||||
*/
|
*/
|
||||||
'success'?: boolean;
|
'success'?: boolean;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface ApiV1AssistantsIdScenePromptsGet200Response
|
||||||
|
*/
|
||||||
|
export interface ApiV1AssistantsIdScenePromptsGet200Response {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {Array<EntityScenePrompt>}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsGet200Response
|
||||||
|
*/
|
||||||
|
'data'?: Array<EntityScenePrompt>;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsGet200Response
|
||||||
|
*/
|
||||||
|
'error'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsGet200Response
|
||||||
|
*/
|
||||||
|
'message'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsGet200Response
|
||||||
|
*/
|
||||||
|
'success'?: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface ApiV1AssistantsIdScenePromptsPost200Response
|
||||||
|
*/
|
||||||
|
export interface ApiV1AssistantsIdScenePromptsPost200Response {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {EntityScenePrompt}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsPost200Response
|
||||||
|
*/
|
||||||
|
'data'?: EntityScenePrompt;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsPost200Response
|
||||||
|
*/
|
||||||
|
'error'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsPost200Response
|
||||||
|
*/
|
||||||
|
'message'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof ApiV1AssistantsIdScenePromptsPost200Response
|
||||||
|
*/
|
||||||
|
'success'?: boolean;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
@ -476,6 +538,37 @@ export interface ApiV1ChatsIdMessagesGet200Response {
|
|||||||
*/
|
*/
|
||||||
'success'?: boolean;
|
'success'?: boolean;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface ApiV1ChatsIdMessagesPaginateGet200Response
|
||||||
|
*/
|
||||||
|
export interface ApiV1ChatsIdMessagesPaginateGet200Response {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {PagePagedResultEntityChatMessageList}
|
||||||
|
* @memberof ApiV1ChatsIdMessagesPaginateGet200Response
|
||||||
|
*/
|
||||||
|
'data'?: PagePagedResultEntityChatMessageList;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ApiV1ChatsIdMessagesPaginateGet200Response
|
||||||
|
*/
|
||||||
|
'error'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ApiV1ChatsIdMessagesPaginateGet200Response
|
||||||
|
*/
|
||||||
|
'message'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof ApiV1ChatsIdMessagesPaginateGet200Response
|
||||||
|
*/
|
||||||
|
'success'?: boolean;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
@ -1383,6 +1476,55 @@ export interface EntityMemory {
|
|||||||
*/
|
*/
|
||||||
'user_id'?: string;
|
'user_id'?: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface EntityScenePrompt
|
||||||
|
*/
|
||||||
|
export interface EntityScenePrompt {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {EntityAssistant}
|
||||||
|
* @memberof EntityScenePrompt
|
||||||
|
*/
|
||||||
|
'assistant'?: EntityAssistant;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof EntityScenePrompt
|
||||||
|
*/
|
||||||
|
'assistant_id'?: number;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof EntityScenePrompt
|
||||||
|
*/
|
||||||
|
'created_at'?: string;
|
||||||
|
/**
|
||||||
|
* Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"`
|
||||||
|
* @type {number}
|
||||||
|
* @memberof EntityScenePrompt
|
||||||
|
*/
|
||||||
|
'id'?: number;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof EntityScenePrompt
|
||||||
|
*/
|
||||||
|
'label'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof EntityScenePrompt
|
||||||
|
*/
|
||||||
|
'prompt'?: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof EntityScenePrompt
|
||||||
|
*/
|
||||||
|
'updated_at'?: string;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
@ -1444,12 +1586,61 @@ export interface EntityTool {
|
|||||||
*/
|
*/
|
||||||
'user_id'?: string;
|
'user_id'?: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface PagePagedResultEntityChatMessageList
|
||||||
|
*/
|
||||||
|
export interface PagePagedResultEntityChatMessageList {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof PagePagedResultEntityChatMessageList
|
||||||
|
*/
|
||||||
|
'count'?: number;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {Array<EntityChatMessageList>}
|
||||||
|
* @memberof PagePagedResultEntityChatMessageList
|
||||||
|
*/
|
||||||
|
'data'?: Array<EntityChatMessageList>;
|
||||||
|
/**
|
||||||
|
* 当前页码
|
||||||
|
* @type {number}
|
||||||
|
* @memberof PagePagedResultEntityChatMessageList
|
||||||
|
*/
|
||||||
|
'page'?: number;
|
||||||
|
/**
|
||||||
|
* 每页大小
|
||||||
|
* @type {number}
|
||||||
|
* @memberof PagePagedResultEntityChatMessageList
|
||||||
|
*/
|
||||||
|
'page_size'?: number;
|
||||||
|
/**
|
||||||
|
* 数据总条数
|
||||||
|
* @type {number}
|
||||||
|
* @memberof PagePagedResultEntityChatMessageList
|
||||||
|
*/
|
||||||
|
'total_count'?: number;
|
||||||
|
/**
|
||||||
|
* 总页数
|
||||||
|
* @type {number}
|
||||||
|
* @memberof PagePagedResultEntityChatMessageList
|
||||||
|
*/
|
||||||
|
'total_pages'?: number;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface PagePagedResultSchemaAssistantPublic
|
* @interface PagePagedResultSchemaAssistantPublic
|
||||||
*/
|
*/
|
||||||
export interface PagePagedResultSchemaAssistantPublic {
|
export interface PagePagedResultSchemaAssistantPublic {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof PagePagedResultSchemaAssistantPublic
|
||||||
|
*/
|
||||||
|
'count'?: number;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {Array<SchemaAssistantPublic>}
|
* @type {Array<SchemaAssistantPublic>}
|
||||||
@ -1830,6 +2021,25 @@ export interface SchemaChatUpdateRequest {
|
|||||||
*/
|
*/
|
||||||
'prompt'?: string;
|
'prompt'?: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface SchemaCreateAssistantScenePromptRequest
|
||||||
|
*/
|
||||||
|
export interface SchemaCreateAssistantScenePromptRequest {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SchemaCreateAssistantScenePromptRequest
|
||||||
|
*/
|
||||||
|
'label': string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SchemaCreateAssistantScenePromptRequest
|
||||||
|
*/
|
||||||
|
'prompt': string;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
@ -2781,6 +2991,127 @@ export const AssistantApiAxiosParamCreator = function (configuration?: Configura
|
|||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 列出当前助理的场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1AssistantsIdScenePromptsGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'id' is not null or undefined
|
||||||
|
assertParamExists('apiV1AssistantsIdScenePromptsGet', 'id', id)
|
||||||
|
const localVarPath = `/api/v1/assistants/{id}/scene_prompts`
|
||||||
|
.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: '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 创建场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {SchemaCreateAssistantScenePromptRequest} createAssistantScenePromptRequest CreateAssistantScenePromptRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1AssistantsIdScenePromptsPost: async (id: number, createAssistantScenePromptRequest: SchemaCreateAssistantScenePromptRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'id' is not null or undefined
|
||||||
|
assertParamExists('apiV1AssistantsIdScenePromptsPost', 'id', id)
|
||||||
|
// verify required parameter 'createAssistantScenePromptRequest' is not null or undefined
|
||||||
|
assertParamExists('apiV1AssistantsIdScenePromptsPost', 'createAssistantScenePromptRequest', createAssistantScenePromptRequest)
|
||||||
|
const localVarPath = `/api/v1/assistants/{id}/scene_prompts`
|
||||||
|
.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: 'POST', ...baseOptions, ...options};
|
||||||
|
const localVarHeaderParameter = {} as any;
|
||||||
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
|
// authentication ApiKeyAuth required
|
||||||
|
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
localVarRequestOptions.data = serializeDataIfNeeded(createAssistantScenePromptRequest, localVarRequestOptions, configuration)
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: toPathString(localVarUrlObj),
|
||||||
|
options: localVarRequestOptions,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 删除场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {number} sceneId
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1AssistantsIdScenePromptsSceneIdDelete: async (id: number, sceneId: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'id' is not null or undefined
|
||||||
|
assertParamExists('apiV1AssistantsIdScenePromptsSceneIdDelete', 'id', id)
|
||||||
|
// verify required parameter 'sceneId' is not null or undefined
|
||||||
|
assertParamExists('apiV1AssistantsIdScenePromptsSceneIdDelete', 'sceneId', sceneId)
|
||||||
|
const localVarPath = `/api/v1/assistants/{id}/scene_prompts/{scene_id}`
|
||||||
|
.replace(`{${"id"}}`, encodeURIComponent(String(id)))
|
||||||
|
.replace(`{${"scene_id"}}`, encodeURIComponent(String(sceneId)));
|
||||||
|
// 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 获取 Assistant 所绑定的 Tool
|
* @summary 获取 Assistant 所绑定的 Tool
|
||||||
@ -3193,6 +3524,47 @@ export const AssistantApiFp = function(configuration?: Configuration) {
|
|||||||
const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdPut']?.[localVarOperationServerIndex]?.url;
|
const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdPut']?.[localVarOperationServerIndex]?.url;
|
||||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 列出当前助理的场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiV1AssistantsIdScenePromptsGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiV1AssistantsIdScenePromptsGet200Response>> {
|
||||||
|
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdScenePromptsGet(id, options);
|
||||||
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
|
const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdScenePromptsGet']?.[localVarOperationServerIndex]?.url;
|
||||||
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 创建场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {SchemaCreateAssistantScenePromptRequest} createAssistantScenePromptRequest CreateAssistantScenePromptRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiV1AssistantsIdScenePromptsPost(id: number, createAssistantScenePromptRequest: SchemaCreateAssistantScenePromptRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiV1AssistantsIdScenePromptsPost200Response>> {
|
||||||
|
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdScenePromptsPost(id, createAssistantScenePromptRequest, options);
|
||||||
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
|
const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdScenePromptsPost']?.[localVarOperationServerIndex]?.url;
|
||||||
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 删除场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {number} sceneId
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiV1AssistantsIdScenePromptsSceneIdDelete(id: number, sceneId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
|
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdScenePromptsSceneIdDelete(id, sceneId, options);
|
||||||
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
|
const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdScenePromptsSceneIdDelete']?.[localVarOperationServerIndex]?.url;
|
||||||
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 获取 Assistant 所绑定的 Tool
|
* @summary 获取 Assistant 所绑定的 Tool
|
||||||
@ -3398,6 +3770,38 @@ export const AssistantApiFactory = function (configuration?: Configuration, base
|
|||||||
apiV1AssistantsIdPut(id: number, assistantUpdateRequest: SchemaAssistantUpdateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1AssistantsPost200Response> {
|
apiV1AssistantsIdPut(id: number, assistantUpdateRequest: SchemaAssistantUpdateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1AssistantsPost200Response> {
|
||||||
return localVarFp.apiV1AssistantsIdPut(id, assistantUpdateRequest, options).then((request) => request(axios, basePath));
|
return localVarFp.apiV1AssistantsIdPut(id, assistantUpdateRequest, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 列出当前助理的场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1AssistantsIdScenePromptsGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1AssistantsIdScenePromptsGet200Response> {
|
||||||
|
return localVarFp.apiV1AssistantsIdScenePromptsGet(id, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 创建场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {SchemaCreateAssistantScenePromptRequest} createAssistantScenePromptRequest CreateAssistantScenePromptRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1AssistantsIdScenePromptsPost(id: number, createAssistantScenePromptRequest: SchemaCreateAssistantScenePromptRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1AssistantsIdScenePromptsPost200Response> {
|
||||||
|
return localVarFp.apiV1AssistantsIdScenePromptsPost(id, createAssistantScenePromptRequest, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 删除场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {number} sceneId
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1AssistantsIdScenePromptsSceneIdDelete(id: number, sceneId: number, options?: RawAxiosRequestConfig): AxiosPromise<void> {
|
||||||
|
return localVarFp.apiV1AssistantsIdScenePromptsSceneIdDelete(id, sceneId, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 获取 Assistant 所绑定的 Tool
|
* @summary 获取 Assistant 所绑定的 Tool
|
||||||
@ -3602,6 +4006,44 @@ export class AssistantApi extends BaseAPI {
|
|||||||
return AssistantApiFp(this.configuration).apiV1AssistantsIdPut(id, assistantUpdateRequest, options).then((request) => request(this.axios, this.basePath));
|
return AssistantApiFp(this.configuration).apiV1AssistantsIdPut(id, assistantUpdateRequest, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 列出当前助理的场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof AssistantApi
|
||||||
|
*/
|
||||||
|
public apiV1AssistantsIdScenePromptsGet(id: number, options?: RawAxiosRequestConfig) {
|
||||||
|
return AssistantApiFp(this.configuration).apiV1AssistantsIdScenePromptsGet(id, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 创建场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {SchemaCreateAssistantScenePromptRequest} createAssistantScenePromptRequest CreateAssistantScenePromptRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof AssistantApi
|
||||||
|
*/
|
||||||
|
public apiV1AssistantsIdScenePromptsPost(id: number, createAssistantScenePromptRequest: SchemaCreateAssistantScenePromptRequest, options?: RawAxiosRequestConfig) {
|
||||||
|
return AssistantApiFp(this.configuration).apiV1AssistantsIdScenePromptsPost(id, createAssistantScenePromptRequest, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 删除场景 Prompt
|
||||||
|
* @param {number} id
|
||||||
|
* @param {number} sceneId
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof AssistantApi
|
||||||
|
*/
|
||||||
|
public apiV1AssistantsIdScenePromptsSceneIdDelete(id: number, sceneId: number, options?: RawAxiosRequestConfig) {
|
||||||
|
return AssistantApiFp(this.configuration).apiV1AssistantsIdScenePromptsSceneIdDelete(id, sceneId, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 获取 Assistant 所绑定的 Tool
|
* @summary 获取 Assistant 所绑定的 Tool
|
||||||
@ -4298,6 +4740,48 @@ export const ChatMessageApiAxiosParamCreator = function (configuration?: Configu
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 {number} [page]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1ChatsIdMessagesPaginateGet: async (id: number, page?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'id' is not null or undefined
|
||||||
|
assertParamExists('apiV1ChatsIdMessagesPaginateGet', 'id', id)
|
||||||
|
const localVarPath = `/api/v1/chats/{id}/messages/paginate`
|
||||||
|
.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: 'GET', ...baseOptions, ...options};
|
||||||
|
const localVarHeaderParameter = {} as any;
|
||||||
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
|
// authentication ApiKeyAuth required
|
||||||
|
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
||||||
|
|
||||||
|
if (page !== undefined) {
|
||||||
|
localVarQueryParameter['page'] = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
@ -4439,6 +4923,20 @@ export const ChatMessageApiFp = function(configuration?: Configuration) {
|
|||||||
const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdMessagesGet']?.[localVarOperationServerIndex]?.url;
|
const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdMessagesGet']?.[localVarOperationServerIndex]?.url;
|
||||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 获取一个对话的所有聊天记录
|
||||||
|
* @summary 分页获取聊天记录
|
||||||
|
* @param {number} id
|
||||||
|
* @param {number} [page]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiV1ChatsIdMessagesPaginateGet(id: number, page?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiV1ChatsIdMessagesPaginateGet200Response>> {
|
||||||
|
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsIdMessagesPaginateGet(id, page, options);
|
||||||
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
|
const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdMessagesPaginateGet']?.[localVarOperationServerIndex]?.url;
|
||||||
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 添加一条消息
|
* 添加一条消息
|
||||||
* @summary 添加聊天记录
|
* @summary 添加聊天记录
|
||||||
@ -4508,6 +5006,17 @@ export const ChatMessageApiFactory = function (configuration?: Configuration, ba
|
|||||||
apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1ChatsIdMessagesGet200Response> {
|
apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1ChatsIdMessagesGet200Response> {
|
||||||
return localVarFp.apiV1ChatsIdMessagesGet(id, options).then((request) => request(axios, basePath));
|
return localVarFp.apiV1ChatsIdMessagesGet(id, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 获取一个对话的所有聊天记录
|
||||||
|
* @summary 分页获取聊天记录
|
||||||
|
* @param {number} id
|
||||||
|
* @param {number} [page]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiV1ChatsIdMessagesPaginateGet(id: number, page?: number, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1ChatsIdMessagesPaginateGet200Response> {
|
||||||
|
return localVarFp.apiV1ChatsIdMessagesPaginateGet(id, page, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 添加一条消息
|
* 添加一条消息
|
||||||
* @summary 添加聊天记录
|
* @summary 添加聊天记录
|
||||||
@ -4577,6 +5086,19 @@ export class ChatMessageApi extends BaseAPI {
|
|||||||
return ChatMessageApiFp(this.configuration).apiV1ChatsIdMessagesGet(id, options).then((request) => request(this.axios, this.basePath));
|
return ChatMessageApiFp(this.configuration).apiV1ChatsIdMessagesGet(id, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一个对话的所有聊天记录
|
||||||
|
* @summary 分页获取聊天记录
|
||||||
|
* @param {number} id
|
||||||
|
* @param {number} [page]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof ChatMessageApi
|
||||||
|
*/
|
||||||
|
public apiV1ChatsIdMessagesPaginateGet(id: number, page?: number, options?: RawAxiosRequestConfig) {
|
||||||
|
return ChatMessageApiFp(this.configuration).apiV1ChatsIdMessagesPaginateGet(id, page, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加一条消息
|
* 添加一条消息
|
||||||
* @summary 添加聊天记录
|
* @summary 添加聊天记录
|
||||||
|
@ -168,6 +168,82 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<n-divider v-if="!scenePrompts.length" />
|
||||||
|
<div v-else class="mt-10"></div>
|
||||||
|
<div>
|
||||||
|
<div class="flex justify-between align-middle items-center">
|
||||||
|
<div>
|
||||||
|
<n-h3 class="inline">场景提示词</n-h3>
|
||||||
|
<n-popover trigger="hover">
|
||||||
|
<template #trigger>
|
||||||
|
<n-icon size="16"><HelpCircleOutline /></n-icon>
|
||||||
|
</template>
|
||||||
|
<div>
|
||||||
|
<n-text
|
||||||
|
>Amber 可以根据不同的上下文场景来自动附加系统提示词</n-text
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</n-popover>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<n-button
|
||||||
|
tertiary
|
||||||
|
@click="showCreateScenePromptForm = !showCreateScenePromptForm"
|
||||||
|
>
|
||||||
|
新场景提示词
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-show="showCreateScenePromptForm" class="mt-3">
|
||||||
|
<n-card title="新场景提示词" role="dialog">
|
||||||
|
<n-input
|
||||||
|
v-model:value="newScenePrompt.label"
|
||||||
|
type="text"
|
||||||
|
placeholder="标签"
|
||||||
|
/>
|
||||||
|
<n-input
|
||||||
|
class="mt-3"
|
||||||
|
v-model:value="newScenePrompt.prompt"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="提示词"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="text-right mt-3">
|
||||||
|
<n-button type="primary" @click="createAssistantScenePrompt"
|
||||||
|
>创建</n-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
<n-list hoverable clickable v-if="scenePrompts.length" class="mt-3">
|
||||||
|
<n-list-item v-for="c in scenePrompts" :key="c.id">
|
||||||
|
<n-thing :title="c.label">
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<div>{{ c.prompt }}</div>
|
||||||
|
<div>
|
||||||
|
<n-popconfirm
|
||||||
|
@positive-click="deleteAssistantScenePrompt(c.id ?? 0)"
|
||||||
|
>
|
||||||
|
<template #trigger>
|
||||||
|
<n-button quaternary circle type="warning">
|
||||||
|
<template #icon>
|
||||||
|
<n-icon size="16" class="cursor-pointer">
|
||||||
|
<TrashBinOutline />
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
<div>删除后,这条规则将不再生效</div>
|
||||||
|
</n-popconfirm>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-thing>
|
||||||
|
</n-list-item>
|
||||||
|
</n-list>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<n-divider v-if="!userTools.length" />
|
<n-divider v-if="!userTools.length" />
|
||||||
<div v-else class="mt-10"></div>
|
<div v-else class="mt-10"></div>
|
||||||
<div>
|
<div>
|
||||||
@ -186,7 +262,8 @@
|
|||||||
<n-text>
|
<n-text>
|
||||||
我们的 API 端点是:{{
|
我们的 API 端点是:{{
|
||||||
config.backend
|
config.backend
|
||||||
}}/api/openai-compatible/v1 。密钥为下方的 API Key,OpenAI 格式不支持智能上下文(不支持近乎无限的上下文)
|
}}/api/openai-compatible/v1 。密钥为下方的 API Key,OpenAI
|
||||||
|
格式不支持智能上下文(不支持近乎无限的上下文)
|
||||||
</n-text>
|
</n-text>
|
||||||
</div>
|
</div>
|
||||||
</n-popover>
|
</n-popover>
|
||||||
@ -202,12 +279,20 @@
|
|||||||
等做一个请求限制),来防止 API Key 滥用。
|
等做一个请求限制),来防止 API Key 滥用。
|
||||||
<br />
|
<br />
|
||||||
当然,如果您在自己的私有应用中使用,可以忽略此建议。
|
当然,如果您在自己的私有应用中使用,可以忽略此建议。
|
||||||
|
<br />
|
||||||
|
!! 注意: Amber Assistant Public API 不需要在前面加 sk- !!
|
||||||
</div>
|
</div>
|
||||||
</n-popconfirm>
|
</n-popconfirm>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<n-p>我们更新了计费系统,在使用此功能之前,请前往 <n-a target="_blank" href="https://auth.leaflow.cn/balances">UserLand</n-a> 来添加余额。我们正在且长期会处于测试阶段,不会对您发起真实付费(也就是说完全免费!)</n-p>
|
<n-p
|
||||||
|
>我们更新了计费系统,在使用此功能之前,请前往
|
||||||
|
<n-a target="_blank" href="https://auth.leaflow.cn/balances"
|
||||||
|
>UserLand</n-a
|
||||||
|
>
|
||||||
|
来添加余额。我们正在且长期会处于测试阶段,不会对您发起真实付费(也就是说完全免费!)</n-p
|
||||||
|
>
|
||||||
<n-list hoverable clickable v-if="assistantApiKeys.length">
|
<n-list hoverable clickable v-if="assistantApiKeys.length">
|
||||||
<n-list-item v-for="c in assistantApiKeys" :key="c.id">
|
<n-list-item v-for="c in assistantApiKeys" :key="c.id">
|
||||||
<n-thing>
|
<n-thing>
|
||||||
@ -291,6 +376,7 @@ import {
|
|||||||
EntityAssistantKey,
|
EntityAssistantKey,
|
||||||
EntityAssistantTool,
|
EntityAssistantTool,
|
||||||
EntityLibrary,
|
EntityLibrary,
|
||||||
|
EntityScenePrompt,
|
||||||
EntityTool,
|
EntityTool,
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import { useIsMobile } from "@/utils/composables";
|
import { useIsMobile } from "@/utils/composables";
|
||||||
@ -309,6 +395,13 @@ const assistants: Ref<EntityAssistant[]> = ref([]);
|
|||||||
const librarySelects: any = ref([]);
|
const librarySelects: any = ref([]);
|
||||||
const libraries: Ref<EntityLibrary[]> = ref([]);
|
const libraries: Ref<EntityLibrary[]> = ref([]);
|
||||||
const assistantApiKeys: Ref<EntityAssistantKey[]> = ref([]);
|
const assistantApiKeys: Ref<EntityAssistantKey[]> = ref([]);
|
||||||
|
const showCreateScenePromptForm = ref(false);
|
||||||
|
const scenePrompts: Ref<EntityScenePrompt[]> = ref([]);
|
||||||
|
|
||||||
|
const newScenePrompt = ref({
|
||||||
|
label: "",
|
||||||
|
prompt: "",
|
||||||
|
});
|
||||||
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const drawerWidth = computed(() => {
|
const drawerWidth = computed(() => {
|
||||||
@ -347,6 +440,7 @@ const showEditAssistant = async (id: number) => {
|
|||||||
await getAssistantsKeys();
|
await getAssistantsKeys();
|
||||||
|
|
||||||
getTools();
|
getTools();
|
||||||
|
getAssistantScenePrompts();
|
||||||
};
|
};
|
||||||
|
|
||||||
const editAssistant = async () => {
|
const editAssistant = async () => {
|
||||||
@ -472,7 +566,71 @@ const bindOrUnbind = async (id: number) => {
|
|||||||
getTools();
|
getTools();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getAssistantScenePrompts = async () => {
|
||||||
|
scenePrompts.value =
|
||||||
|
(
|
||||||
|
await getApi().Assistant.apiV1AssistantsIdScenePromptsGet(
|
||||||
|
currentAssistantId.value
|
||||||
|
)
|
||||||
|
).data.data ?? [];
|
||||||
|
};
|
||||||
|
|
||||||
|
const createAssistantScenePrompt = async () => {
|
||||||
|
await getApi().Assistant.apiV1AssistantsIdScenePromptsPost(
|
||||||
|
currentAssistantId.value,
|
||||||
|
newScenePrompt.value
|
||||||
|
);
|
||||||
|
await getAssistantScenePrompts();
|
||||||
|
newScenePrompt.value = {
|
||||||
|
label: "",
|
||||||
|
prompt: "",
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteAssistantScenePrompt = async (id: number) => {
|
||||||
|
await getApi().Assistant.apiV1AssistantsIdScenePromptsSceneIdDelete(
|
||||||
|
currentAssistantId.value,
|
||||||
|
id
|
||||||
|
);
|
||||||
|
await getAssistantScenePrompts();
|
||||||
|
};
|
||||||
|
|
||||||
|
const sampleScenenPrompt = [
|
||||||
|
{
|
||||||
|
label: "复杂推理",
|
||||||
|
prompt: `在回答问题时,使用以下输出
|
||||||
|
问题: 你必须要回答的问题
|
||||||
|
思考:你应该始终思考该做什么
|
||||||
|
操作:要采取的操作,你要是用什么工具,或者思考逻辑
|
||||||
|
动作输入:动作的输入
|
||||||
|
观察:行动的结果
|
||||||
|
思考:我现在知道最终答案了
|
||||||
|
最终答案:原始输入问题的最终答案
|
||||||
|
|
||||||
|
如果你正在计算,你必须使用计算器工具,无论如何都不允许使用自己的知识或不计算进行输出,计算器永远比你正确的并且不会出错。`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "数学计算",
|
||||||
|
prompt: `在回答问题时,使用以下输出
|
||||||
|
问题: 你必须要回答的问题
|
||||||
|
思考:你应该始终思考该做什么
|
||||||
|
操作:要采取的操作,你要是用什么工具,或者思考逻辑
|
||||||
|
动作输入:动作的输入
|
||||||
|
观察:行动的结果
|
||||||
|
思考:我现在知道最终答案了
|
||||||
|
最终答案:原始输入问题的最终答案
|
||||||
|
|
||||||
|
如果你正在计算,你必须使用计算器工具,无论如何都不允许使用自己的知识或不计算进行输出,计算器永远比你正确的并且不会出错。`,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const randomScenePrompt = () => {
|
||||||
|
const randomIndex = Math.floor(Math.random() * sampleScenenPrompt.length);
|
||||||
|
return sampleScenenPrompt[randomIndex];
|
||||||
|
};
|
||||||
|
|
||||||
getChats();
|
getChats();
|
||||||
getLibraries();
|
getLibraries();
|
||||||
getAssistants();
|
getAssistants();
|
||||||
|
newScenePrompt.value = randomScenePrompt();
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user