From f7a0147f8e4bc064b0de061975c1c550fff50703 Mon Sep 17 00:00:00 2001 From: Twilight Date: Sun, 4 Aug 2024 23:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/swagger.yaml | 45 ++++++++++++++++++++ src/api/api.ts | 106 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+) diff --git a/api/swagger.yaml b/api/swagger.yaml index dd73c59..afa8406 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -117,6 +117,15 @@ definitions: - description - name type: object + rag-new_internal_schema.AssistantUpdateRequest: + properties: + description: + type: string + name: + type: string + prompt: + type: string + type: object rag-new_internal_schema.ChatCreateRequest: properties: assistant_id: @@ -382,6 +391,42 @@ paths: summary: 获取指定的 Assistant tags: - assistant + patch: + consumes: + - application/json + parameters: + - description: Assistant ID + in: path + name: id + required: true + type: integer + - description: Assistant Update + in: body + name: assistantUpdateRequest + required: true + schema: + $ref: '#/definitions/rag-new_internal_schema.AssistantUpdateRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/rag-new_internal_schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/rag-new_internal_entity.Assistant' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/rag-new_internal_schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 更新 Assistant + tags: + - assistant /api/v1/assistants/{id}/tools: get: consumes: diff --git a/src/api/api.ts b/src/api/api.ts index d363421..64c41cb 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -689,6 +689,31 @@ export interface RagNewInternalSchemaAssistantCreateRequest { */ 'prompt'?: string; } +/** + * + * @export + * @interface RagNewInternalSchemaAssistantUpdateRequest + */ +export interface RagNewInternalSchemaAssistantUpdateRequest { + /** + * + * @type {string} + * @memberof RagNewInternalSchemaAssistantUpdateRequest + */ + 'description'?: string; + /** + * + * @type {string} + * @memberof RagNewInternalSchemaAssistantUpdateRequest + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof RagNewInternalSchemaAssistantUpdateRequest + */ + 'prompt'?: string; +} /** * * @export @@ -1147,6 +1172,49 @@ export const AssistantApiAxiosParamCreator = function (configuration?: Configura options: localVarRequestOptions, }; }, + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {RagNewInternalSchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdPatch: async (id: number, assistantUpdateRequest: RagNewInternalSchemaAssistantUpdateRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdPatch', 'id', id) + // verify required parameter 'assistantUpdateRequest' is not null or undefined + assertParamExists('apiV1AssistantsIdPatch', 'assistantUpdateRequest', assistantUpdateRequest) + const localVarPath = `/api/v1/assistants/{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: 'PATCH', ...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(assistantUpdateRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary 获取 Assistant 所绑定的 Tool @@ -1353,6 +1421,20 @@ export const AssistantApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {RagNewInternalSchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdPatch(id: number, assistantUpdateRequest: RagNewInternalSchemaAssistantUpdateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdPatch(id, assistantUpdateRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdPatch']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * * @summary 获取 Assistant 所绑定的 Tool @@ -1446,6 +1528,17 @@ export const AssistantApiFactory = function (configuration?: Configuration, base apiV1AssistantsIdGet(id: number, options?: any): AxiosPromise { return localVarFp.apiV1AssistantsIdGet(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {RagNewInternalSchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdPatch(id: number, assistantUpdateRequest: RagNewInternalSchemaAssistantUpdateRequest, options?: any): AxiosPromise { + return localVarFp.apiV1AssistantsIdPatch(id, assistantUpdateRequest, options).then((request) => request(axios, basePath)); + }, /** * * @summary 获取 Assistant 所绑定的 Tool @@ -1533,6 +1626,19 @@ export class AssistantApi extends BaseAPI { return AssistantApiFp(this.configuration).apiV1AssistantsIdGet(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {RagNewInternalSchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdPatch(id: number, assistantUpdateRequest: RagNewInternalSchemaAssistantUpdateRequest, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdPatch(id, assistantUpdateRequest, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary 获取 Assistant 所绑定的 Tool