From 6ac7af786d1bd1537d1ffe0d5fd227efc8828a1b Mon Sep 17 00:00:00 2001 From: ivamp Date: Sat, 17 Aug 2024 17:30:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/swagger.yaml | 30 ++++ src/api/api.ts | 375 ++++++++++++++++++++++++++--------------------- 2 files changed, 239 insertions(+), 166 deletions(-) diff --git a/api/swagger.yaml b/api/swagger.yaml index 5b86b87..8568996 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -132,10 +132,19 @@ definitions: type: string message: type: string + role: + enum: + - user + - user_hide + - system + - system_hide + - assistant + type: string required: - assistant_token - guest_id - message + - role type: object rag-new_internal_schema.AssistantCreateRequest: properties: @@ -190,11 +199,22 @@ definitions: message: maxLength: 255 type: string + role: + enum: + - user + - user_hide + - system + - system_hide + - assistant + type: string required: - message + - role type: object rag-new_internal_schema.ChatMessageResponse: properties: + stream: + type: boolean stream_id: type: string type: object @@ -421,6 +441,11 @@ paths: - application/json description: 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token parameters: + - description: 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 + Prompt 选项 + in: header + name: X-User-IP + type: string - description: Chat in: body name: chat @@ -1254,6 +1279,11 @@ paths: - application/json description: get string by ID parameters: + - description: 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 + Prompt 选项 + in: header + name: X-User-IP + type: string - description: Chat ID in: path name: id diff --git a/src/api/api.ts b/src/api/api.ts index 524762d..dbff738 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -23,6 +23,37 @@ import type { RequestArgs } from './base'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base'; +/** + * + * @export + * @interface ApiOpenaiCompatibleV1ChatCompletionsPost200Response + */ +export interface ApiOpenaiCompatibleV1ChatCompletionsPost200Response { + /** + * + * @type {RagNewInternalSchemaOpenAIChatCompletionResponse} + * @memberof ApiOpenaiCompatibleV1ChatCompletionsPost200Response + */ + 'data'?: RagNewInternalSchemaOpenAIChatCompletionResponse; + /** + * + * @type {string} + * @memberof ApiOpenaiCompatibleV1ChatCompletionsPost200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiOpenaiCompatibleV1ChatCompletionsPost200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiOpenaiCompatibleV1ChatCompletionsPost200Response + */ + 'success'?: boolean; +} /** * * @export @@ -333,37 +364,6 @@ export interface ApiV1ChatPublicPost200Response { */ 'success'?: boolean; } -/** - * - * @export - * @interface ApiV1OpenaiCompatibleCompletionPost200Response - */ -export interface ApiV1OpenaiCompatibleCompletionPost200Response { - /** - * - * @type {RagNewInternalSchemaOpenAIChatCompletionResponse} - * @memberof ApiV1OpenaiCompatibleCompletionPost200Response - */ - 'data'?: RagNewInternalSchemaOpenAIChatCompletionResponse; - /** - * - * @type {string} - * @memberof ApiV1OpenaiCompatibleCompletionPost200Response - */ - 'error'?: string; - /** - * - * @type {string} - * @memberof ApiV1OpenaiCompatibleCompletionPost200Response - */ - 'message'?: string; - /** - * - * @type {boolean} - * @memberof ApiV1OpenaiCompatibleCompletionPost200Response - */ - 'success'?: boolean; -} /** * * @export @@ -842,7 +842,24 @@ export interface RagNewInternalSchemaAddPublicChatMessageRequest { * @memberof RagNewInternalSchemaAddPublicChatMessageRequest */ 'message': string; + /** + * + * @type {string} + * @memberof RagNewInternalSchemaAddPublicChatMessageRequest + */ + 'role': RagNewInternalSchemaAddPublicChatMessageRequestRoleEnum; } + +export const RagNewInternalSchemaAddPublicChatMessageRequestRoleEnum = { + User: 'user', + UserHide: 'user_hide', + System: 'system', + SystemHide: 'system_hide', + Assistant: 'assistant' +} as const; + +export type RagNewInternalSchemaAddPublicChatMessageRequestRoleEnum = typeof RagNewInternalSchemaAddPublicChatMessageRequestRoleEnum[keyof typeof RagNewInternalSchemaAddPublicChatMessageRequestRoleEnum]; + /** * * @export @@ -936,13 +953,36 @@ export interface RagNewInternalSchemaChatMessageAddRequest { * @memberof RagNewInternalSchemaChatMessageAddRequest */ 'message': string; + /** + * + * @type {string} + * @memberof RagNewInternalSchemaChatMessageAddRequest + */ + 'role': RagNewInternalSchemaChatMessageAddRequestRoleEnum; } + +export const RagNewInternalSchemaChatMessageAddRequestRoleEnum = { + User: 'user', + UserHide: 'user_hide', + System: 'system', + SystemHide: 'system_hide', + Assistant: 'assistant' +} as const; + +export type RagNewInternalSchemaChatMessageAddRequestRoleEnum = typeof RagNewInternalSchemaChatMessageAddRequestRoleEnum[keyof typeof RagNewInternalSchemaChatMessageAddRequestRoleEnum]; + /** * * @export * @interface RagNewInternalSchemaChatMessageResponse */ export interface RagNewInternalSchemaChatMessageResponse { + /** + * + * @type {boolean} + * @memberof RagNewInternalSchemaChatMessageResponse + */ + 'stream'?: boolean; /** * * @type {string} @@ -1105,12 +1145,6 @@ export interface RagNewInternalSchemaOpenAIChatCompletionRequestMessage { * @memberof RagNewInternalSchemaOpenAIChatCompletionRequestMessage */ 'content'?: string; - /** - * Optional - * @type {string} - * @memberof RagNewInternalSchemaOpenAIChatCompletionRequestMessage - */ - 'name'?: string; /** * Required * @type {string} @@ -1126,10 +1160,10 @@ export interface RagNewInternalSchemaOpenAIChatCompletionRequestMessage { export interface RagNewInternalSchemaOpenAIChatCompletionResponse { /** * - * @type {Array} + * @type {Array} * @memberof RagNewInternalSchemaOpenAIChatCompletionResponse */ - 'choices'?: Array; + 'choices'?: Array; /** * * @type {number} @@ -1142,6 +1176,12 @@ export interface RagNewInternalSchemaOpenAIChatCompletionResponse { * @memberof RagNewInternalSchemaOpenAIChatCompletionResponse */ 'id'?: string; + /** + * + * @type {string} + * @memberof RagNewInternalSchemaOpenAIChatCompletionResponse + */ + 'model'?: string; /** * * @type {string} @@ -1150,67 +1190,29 @@ export interface RagNewInternalSchemaOpenAIChatCompletionResponse { 'object'?: string; /** * - * @type {RagNewInternalSchemaOpenAIChatCompletionResponseUsage} + * @type {RagNewInternalSchemaTokenUsage} * @memberof RagNewInternalSchemaOpenAIChatCompletionResponse */ - 'usage'?: RagNewInternalSchemaOpenAIChatCompletionResponseUsage; + 'usage'?: RagNewInternalSchemaTokenUsage; } /** * * @export - * @interface RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInner + * @interface RagNewInternalSchemaOpenAIChatCompletionResponseChoice */ -export interface RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInner { - /** - * - * @type {string} - * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInner - */ - 'finish_reason'?: string; +export interface RagNewInternalSchemaOpenAIChatCompletionResponseChoice { /** * * @type {number} - * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInner + * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseChoice */ 'index'?: number; /** * - * @type {RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInnerMessage} - * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInner + * @type {RagNewInternalSchemaOpenAIChatCompletionRequestMessage} + * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseChoice */ - 'message'?: RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInnerMessage; -} -/** - * - * @export - * @interface RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInnerMessage - */ -export interface RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInnerMessage { - /** - * - * @type {string} - * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInnerMessage - */ - 'content'?: string; - /** - * - * @type {string} - * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseChoicesInnerMessage - */ - 'role'?: string; -} -/** - * - * @export - * @interface RagNewInternalSchemaOpenAIChatCompletionResponseUsage - */ -export interface RagNewInternalSchemaOpenAIChatCompletionResponseUsage { - /** - * - * @type {number} - * @memberof RagNewInternalSchemaOpenAIChatCompletionResponseUsage - */ - 'total_tokens'?: number; + 'message'?: RagNewInternalSchemaOpenAIChatCompletionRequestMessage; } /** * @@ -1243,6 +1245,31 @@ export interface RagNewInternalSchemaResponseBody { */ 'success'?: boolean; } +/** + * + * @export + * @interface RagNewInternalSchemaTokenUsage + */ +export interface RagNewInternalSchemaTokenUsage { + /** + * + * @type {number} + * @memberof RagNewInternalSchemaTokenUsage + */ + 'completion_tokens'?: number; + /** + * + * @type {number} + * @memberof RagNewInternalSchemaTokenUsage + */ + 'prompt_tokens'?: number; + /** + * + * @type {number} + * @memberof RagNewInternalSchemaTokenUsage + */ + 'total_tokens'?: number; +} /** * * @export @@ -2311,6 +2338,50 @@ export class AssistantApi extends BaseAPI { */ export const ChatApiAxiosParamCreator = function (configuration?: Configuration) { return { + /** + * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token + * @summary OpenAI Chat Completion + * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiOpenaiCompatibleV1ChatCompletionsPost: async (chat: RagNewInternalSchemaOpenAIChatCompletionRequest, xUserIP?: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'chat' is not null or undefined + assertParamExists('apiOpenaiCompatibleV1ChatCompletionsPost', 'chat', chat) + const localVarPath = `/api/openai-compatible/v1/chat/completions`; + // 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) + + if (xUserIP != null) { + localVarHeaderParameter['X-User-IP'] = String(xUserIP); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(chat, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * get string by ID * @summary 获取所有 Chat @@ -2413,45 +2484,6 @@ export const ChatApiAxiosParamCreator = function (configuration?: 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(chat, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token - * @summary OpenAI Chat Completion - * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV1OpenaiCompatibleCompletionPost: async (chat: RagNewInternalSchemaOpenAIChatCompletionRequest, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'chat' is not null or undefined - assertParamExists('apiV1OpenaiCompatibleCompletionPost', 'chat', chat) - const localVarPath = `/api/v1/openai-compatible/completion`; - // 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); @@ -2474,6 +2506,20 @@ export const ChatApiAxiosParamCreator = function (configuration?: Configuration) export const ChatApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ChatApiAxiosParamCreator(configuration) return { + /** + * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token + * @summary OpenAI Chat Completion + * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiOpenaiCompatibleV1ChatCompletionsPost(chat: RagNewInternalSchemaOpenAIChatCompletionRequest, xUserIP?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiOpenaiCompatibleV1ChatCompletionsPost(chat, xUserIP, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatApi.apiOpenaiCompatibleV1ChatCompletionsPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * get string by ID * @summary 获取所有 Chat @@ -2513,19 +2559,6 @@ export const ChatApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['ChatApi.apiV1ChatsPost']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, - /** - * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token - * @summary OpenAI Chat Completion - * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async apiV1OpenaiCompatibleCompletionPost(chat: RagNewInternalSchemaOpenAIChatCompletionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1OpenaiCompatibleCompletionPost(chat, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['ChatApi.apiV1OpenaiCompatibleCompletionPost']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, } }; @@ -2536,6 +2569,17 @@ export const ChatApiFp = function(configuration?: Configuration) { export const ChatApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ChatApiFp(configuration) return { + /** + * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token + * @summary OpenAI Chat Completion + * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiOpenaiCompatibleV1ChatCompletionsPost(chat: RagNewInternalSchemaOpenAIChatCompletionRequest, xUserIP?: string, options?: any): AxiosPromise { + return localVarFp.apiOpenaiCompatibleV1ChatCompletionsPost(chat, xUserIP, options).then((request) => request(axios, basePath)); + }, /** * get string by ID * @summary 获取所有 Chat @@ -2566,16 +2610,6 @@ export const ChatApiFactory = function (configuration?: Configuration, basePath? apiV1ChatsPost(chat: RagNewInternalSchemaChatCreateRequest, options?: any): AxiosPromise { return localVarFp.apiV1ChatsPost(chat, options).then((request) => request(axios, basePath)); }, - /** - * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token - * @summary OpenAI Chat Completion - * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - apiV1OpenaiCompatibleCompletionPost(chat: RagNewInternalSchemaOpenAIChatCompletionRequest, options?: any): AxiosPromise { - return localVarFp.apiV1OpenaiCompatibleCompletionPost(chat, options).then((request) => request(axios, basePath)); - }, }; }; @@ -2586,6 +2620,19 @@ export const ChatApiFactory = function (configuration?: Configuration, basePath? * @extends {BaseAPI} */ export class ChatApi extends BaseAPI { + /** + * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token + * @summary OpenAI Chat Completion + * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatApi + */ + public apiOpenaiCompatibleV1ChatCompletionsPost(chat: RagNewInternalSchemaOpenAIChatCompletionRequest, xUserIP?: string, options?: RawAxiosRequestConfig) { + return ChatApiFp(this.configuration).apiOpenaiCompatibleV1ChatCompletionsPost(chat, xUserIP, options).then((request) => request(this.axios, this.basePath)); + } + /** * get string by ID * @summary 获取所有 Chat @@ -2621,18 +2668,6 @@ export class ChatApi extends BaseAPI { public apiV1ChatsPost(chat: RagNewInternalSchemaChatCreateRequest, options?: RawAxiosRequestConfig) { return ChatApiFp(this.configuration).apiV1ChatsPost(chat, options).then((request) => request(this.axios, this.basePath)); } - - /** - * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token - * @summary OpenAI Chat Completion - * @param {RagNewInternalSchemaOpenAIChatCompletionRequest} chat Chat - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ChatApi - */ - public apiV1OpenaiCompatibleCompletionPost(chat: RagNewInternalSchemaOpenAIChatCompletionRequest, options?: RawAxiosRequestConfig) { - return ChatApiFp(this.configuration).apiV1OpenaiCompatibleCompletionPost(chat, options).then((request) => request(this.axios, this.basePath)); - } } @@ -2765,10 +2800,11 @@ export const ChatMessageApiAxiosParamCreator = function (configuration?: Configu * @summary 流式传输聊天内容 * @param {number} id Chat ID * @param {string} streamId Chat stream id + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - apiV1StreamStreamIdGet: async (id: number, streamId: string, options: RawAxiosRequestConfig = {}): Promise => { + apiV1StreamStreamIdGet: async (id: number, streamId: string, xUserIP?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'id' is not null or undefined assertParamExists('apiV1StreamStreamIdGet', 'id', id) // verify required parameter 'streamId' is not null or undefined @@ -2787,6 +2823,10 @@ export const ChatMessageApiAxiosParamCreator = function (configuration?: Configu const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + if (xUserIP != null) { + localVarHeaderParameter['X-User-IP'] = String(xUserIP); + } + setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -2853,11 +2893,12 @@ export const ChatMessageApiFp = function(configuration?: Configuration) { * @summary 流式传输聊天内容 * @param {number} id Chat ID * @param {string} streamId Chat stream id + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async apiV1StreamStreamIdGet(id: number, streamId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1StreamStreamIdGet(id, streamId, options); + async apiV1StreamStreamIdGet(id: number, streamId: string, xUserIP?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1StreamStreamIdGet(id, streamId, xUserIP, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1StreamStreamIdGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); @@ -2908,11 +2949,12 @@ export const ChatMessageApiFactory = function (configuration?: Configuration, ba * @summary 流式传输聊天内容 * @param {number} id Chat ID * @param {string} streamId Chat stream id + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - apiV1StreamStreamIdGet(id: number, streamId: string, options?: any): AxiosPromise { - return localVarFp.apiV1StreamStreamIdGet(id, streamId, options).then((request) => request(axios, basePath)); + apiV1StreamStreamIdGet(id: number, streamId: string, xUserIP?: string, options?: any): AxiosPromise { + return localVarFp.apiV1StreamStreamIdGet(id, streamId, xUserIP, options).then((request) => request(axios, basePath)); }, }; }; @@ -2966,12 +3008,13 @@ export class ChatMessageApi extends BaseAPI { * @summary 流式传输聊天内容 * @param {number} id Chat ID * @param {string} streamId Chat stream id + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChatMessageApi */ - public apiV1StreamStreamIdGet(id: number, streamId: string, options?: RawAxiosRequestConfig) { - return ChatMessageApiFp(this.configuration).apiV1StreamStreamIdGet(id, streamId, options).then((request) => request(this.axios, this.basePath)); + public apiV1StreamStreamIdGet(id: number, streamId: string, xUserIP?: string, options?: RawAxiosRequestConfig) { + return ChatMessageApiFp(this.configuration).apiV1StreamStreamIdGet(id, streamId, xUserIP, options).then((request) => request(this.axios, this.basePath)); } }