commit 295f14e9f4457bf95cffb85e64b3e43efdf5e1f9 Author: Twilight Date: Tue Sep 10 16:29:08 2024 +0800 add diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json new file mode 100644 index 0000000..b08dacb --- /dev/null +++ b/.eslintrc-auto-import.json @@ -0,0 +1,69 @@ +{ + "globals": { + "Component": true, + "ComponentPublicInstance": true, + "ComputedRef": true, + "EffectScope": true, + "ExtractDefaultPropTypes": true, + "ExtractPropTypes": true, + "ExtractPublicPropTypes": true, + "InjectionKey": true, + "PropType": true, + "Ref": true, + "VNode": true, + "WritableComputedRef": true, + "computed": true, + "createApp": true, + "customRef": true, + "defineAsyncComponent": true, + "defineComponent": true, + "effectScope": true, + "getCurrentInstance": true, + "getCurrentScope": true, + "h": true, + "inject": true, + "isProxy": true, + "isReactive": true, + "isReadonly": true, + "isRef": true, + "markRaw": true, + "nextTick": true, + "onActivated": true, + "onBeforeMount": true, + "onBeforeUnmount": true, + "onBeforeUpdate": true, + "onDeactivated": true, + "onErrorCaptured": true, + "onMounted": true, + "onRenderTracked": true, + "onRenderTriggered": true, + "onScopeDispose": true, + "onServerPrefetch": true, + "onUnmounted": true, + "onUpdated": true, + "provide": true, + "reactive": true, + "readonly": true, + "ref": true, + "resolveComponent": true, + "shallowReactive": true, + "shallowReadonly": true, + "shallowRef": true, + "toRaw": true, + "toRef": true, + "toRefs": true, + "toValue": true, + "triggerRef": true, + "unref": true, + "useAttrs": true, + "useCssModule": true, + "useCssVars": true, + "useRoute": true, + "useRouter": true, + "useSlots": true, + "watch": true, + "watchEffect": true, + "watchPostEffect": true, + "watchSyncEffect": true + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2bc879a --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +wwwroot/*.js +node_modules +typings +dist +.DS_Store +.vscode +.idea +build +yarn.lock diff --git a/api/swagger.yaml b/api/swagger.yaml new file mode 100644 index 0000000..a97288f --- /dev/null +++ b/api/swagger.yaml @@ -0,0 +1,2171 @@ +definitions: + entity.Assistant: + properties: + created_at: + type: string + description: + type: string + disable_default_prompt: + type: boolean + disable_memory: + type: boolean + enable_memory_for_assistant_share: + type: boolean + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + library: + $ref: '#/definitions/entity.Library' + library_id: + type: integer + name: + type: string + prompt: + type: string + updated_at: + type: string + user_id: + type: string + type: object + entity.AssistantShare: + 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 + token: + type: string + updated_at: + type: string + type: object + entity.AssistantTool: + 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 + tool: + $ref: '#/definitions/entity.Tool' + tool_id: + type: integer + updated_at: + type: string + type: object + entity.Chat: + properties: + assistant_id: + type: integer + created_at: + type: string + expired_at: + type: string + guest_id: + type: string + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + name: + type: string + owner: + type: string + updated_at: + type: string + user_id: + type: string + type: object + entity.ChatMessage: + properties: + assistant_id: + type: integer + completion_tokens: + type: integer + content: + type: string + created_at: + type: string + file: + $ref: '#/definitions/entity.File' + file_id: + description: |- + FileId + 虽然有了 UserFileId, 但是 File Id 还是应该保留,因为这个是针对访客用户的 + type: integer + hidden: + type: boolean + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + prompt_tokens: + type: integer + role: + type: string + total_tokens: + type: integer + updated_at: + type: string + user_file: + $ref: '#/definitions/entity.UserFile' + user_file_id: + type: integer + type: object + entity.Document: + properties: + chunked: + type: boolean + created_at: + type: string + file: + $ref: '#/definitions/entity.File' + file_hash: + description: |- + FileHash 是 File 结构体的 hash,用于判断文件内容是否发生变化 + 只不过一般情况也不会改变,因为 File 就不会变 + type: string + file_id: + type: integer + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + library: + $ref: '#/definitions/entity.Library' + library_id: + type: integer + name: + type: string + updated_at: + type: string + type: object + entity.File: + properties: + created_at: + type: string + expired_at: + description: |- + TODO: 移除 file 的到期时间,如果当 file 没有任何引用的时候再删除 + 因为有外键,所以直接删除是删不掉的,必须删除消息 + type: string + file_hash: + type: string + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + mime_type: + type: string + path: + type: string + public: + description: 是否公开,访客上传的文件应始终公开,或归属于所有者 + type: boolean + size: + type: integer + updated_at: + type: string + url: + type: string + url_hash: + type: string + type: object + entity.Library: + properties: + created_at: + type: string + default: + type: boolean + description: + type: string + documents: + items: + $ref: '#/definitions/entity.Document' + type: array + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + name: + type: string + updated_at: + type: string + user_id: + type: string + type: object + entity.Memory: + properties: + content: + type: string + created_at: + type: string + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + updated_at: + type: string + user_id: + type: string + type: object + entity.Tool: + properties: + api_key: + type: string + created_at: + type: string + data: + $ref: '#/definitions/schema.ToolDiscoveryOutput' + description: + type: string + discovery_url: + type: string + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + name: + type: string + updated_at: + type: string + user_id: + type: string + type: object + entity.UserFile: + properties: + created_at: + type: string + file: + $ref: '#/definitions/entity.File' + file_id: + type: integer + id: + description: Id schema.EntityId `gorm:"primarykey" json:"id,string"` + type: integer + updated_at: + type: string + user_id: + type: string + type: object + schema.AddPublicChatMessageRequest: + properties: + assistant_token: + type: string + guest_id: + 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 + schema.AssistantCreateRequest: + properties: + description: + maxLength: 255 + type: string + disable_default_prompt: + enum: + - true + - false + type: boolean + name: + maxLength: 255 + type: string + prompt: + maxLength: 512 + type: string + required: + - description + - name + type: object + schema.AssistantLibraryRequest: + properties: + library_id: + type: integer + required: + - library_id + type: object + schema.AssistantUpdateRequest: + properties: + description: + maxLength: 255 + type: string + disable_default_prompt: + enum: + - 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 + prompt: + maxLength: 512 + type: string + type: object + schema.ChatCreateRequest: + properties: + assistant_id: + type: integer + expired_at: + $ref: '#/definitions/schema.CustomTime' + name: + maxLength: 30 + type: string + required: + - assistant_id + - name + type: object + schema.ChatMessageAddRequest: + properties: + message: + maxLength: 255 + type: string + role: + enum: + - user + - user_hide + - system + - system_hide + - assistant + - image + type: string + required: + - message + - role + type: object + schema.ChatMessageResponse: + properties: + stream: + type: boolean + stream_id: + type: string + type: object + schema.ChatPublicListRequest: + properties: + guest_id: + type: string + required: + - guest_id + type: object + schema.ChatPublicRequest: + properties: + assistant_token: + type: string + guest_id: + type: string + name: + maxLength: 32 + type: string + required: + - assistant_token + - guest_id + - name + type: object + schema.CurrentUserResponse: + properties: + ip: + type: string + userEmail: + type: string + userId: + type: string + userName: + type: string + valid: + type: boolean + type: object + schema.CustomTime: + properties: + time.Time: + type: string + type: object + schema.FunctionsInput: + properties: + description: + type: string + name: + type: string + parameters: + $ref: '#/definitions/schema.ToolDiscoveryOutputFunctionParameters' + required: + - description + - name + - parameters + type: object + schema.GetPublicChatMessageRequest: + properties: + assistant_token: + type: string + guest_id: + type: string + required: + - assistant_token + - guest_id + type: object + schema.LibraryCreateRequest: + properties: + description: + type: string + name: + type: string + required: + - name + type: object + schema.LibraryUpdateRequest: + properties: + default: + type: boolean + description: + type: string + name: + type: string + required: + - name + type: object + schema.OpenAIChatCompletionRequest: + properties: + max_tokens: + description: Optional + type: integer + messages: + description: Required + items: + $ref: '#/definitions/schema.OpenAIChatCompletionRequestMessage' + type: array + model: + description: Required + type: string + "n": + description: Optional + type: integer + stream: + description: Optional + type: boolean + temperature: + description: Optional + type: number + top_p: + description: Optional + type: number + type: object + schema.OpenAIChatCompletionRequestMessage: + properties: + content: + description: Required + image_url: + $ref: '#/definitions/schema.OpenAIImageUrl' + role: + description: Required + type: string + type: object + schema.OpenAIChatCompletionResponse: + properties: + choices: + items: + $ref: '#/definitions/schema.OpenAIChatCompletionResponseChoice' + type: array + created: + type: integer + id: + type: string + model: + type: string + object: + type: string + usage: + $ref: '#/definitions/schema.TokenUsage' + type: object + schema.OpenAIChatCompletionResponseChoice: + properties: + index: + type: integer + message: + $ref: '#/definitions/schema.OpenAIChatCompletionRequestMessage' + type: object + schema.OpenAIImageUrl: + properties: + detail: + type: string + url: + type: string + type: object + schema.ResponseBody: + properties: + data: {} + error: + type: string + message: + type: string + success: + type: boolean + type: object + schema.TokenUsage: + properties: + completion_tokens: + type: integer + prompt_tokens: + type: integer + total_tokens: + type: integer + type: object + schema.ToolCreateRequest: + properties: + api_key: + maxLength: 255 + type: string + description: + maxLength: 255 + type: string + name: + maxLength: 255 + type: string + url: + maxLength: 255 + type: string + required: + - description + - name + - url + type: object + schema.ToolDiscoveryInput: + properties: + callback_url: + type: string + description: + type: string + functions: + items: + $ref: '#/definitions/schema.FunctionsInput' + type: array + homepage_url: + type: string + name: + type: string + required: + - description + - name + type: object + schema.ToolDiscoveryOutput: + properties: + callback_url: + type: string + description: + type: string + function: + items: + $ref: '#/definitions/schema.ToolDiscoveryOutputFunctions' + type: array + homepage_url: + type: string + name: + type: string + type: object + schema.ToolDiscoveryOutputFunction: + properties: + description: + type: string + name: + type: string + parameters: + $ref: '#/definitions/schema.ToolDiscoveryOutputFunctionParameters' + type: object + schema.ToolDiscoveryOutputFunctionParameters: + properties: + properties: {} + required: + items: + type: string + type: array + type: + type: string + required: + - properties + - required + - type + type: object + schema.ToolDiscoveryOutputFunctions: + properties: + functions: + items: + $ref: '#/definitions/schema.ToolDiscoveryOutputFunction' + type: array + type: + type: string + type: object +info: + contact: {} + title: Leaflow Amber + version: "1.0" +paths: + /api/openai-compatible/v1/chat/completions: + post: + consumes: + - 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 + required: true + schema: + $ref: '#/definitions/schema.OpenAIChatCompletionRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/schema.OpenAIChatCompletionResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: OpenAI Chat Completion + tags: + - chat + /api/v1/assistants: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.Assistant' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 获取 Assistant 列表 + tags: + - assistant + post: + consumes: + - application/json + parameters: + - description: Assistant + in: body + name: assistant + required: true + schema: + $ref: '#/definitions/schema.AssistantCreateRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Assistant' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 创建 Assistant + tags: + - assistant + /api/v1/assistants/{id}: + delete: + consumes: + - application/json + parameters: + - description: Assistant ID + in: path + name: 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: 删除 Assistant + tags: + - assistant + get: + consumes: + - application/json + parameters: + - description: Assistant ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Assistant' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + 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/schema.AssistantUpdateRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Assistant' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 更新 Assistant + tags: + - assistant + /api/v1/assistants/{id}/library: + 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: + - assistant + post: + consumes: + - application/json + parameters: + - in: path + name: id + required: true + type: integer + - description: AssistantLibraryRequest + in: body + name: AssistantLibraryRequest + required: true + schema: + $ref: '#/definitions/schema.AssistantLibraryRequest' + produces: + - application/json + responses: + "204": + description: No Content + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 绑定资料库 + tags: + - assistant + /api/v1/assistants/{id}/shares: + get: + consumes: + - application/json + description: 此 API 可以创建一个 Assistant 共享 Token,可以将你的 Assistant 公开出去使用。 + 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.AssistantShare' + type: array + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 获取 Assistant 共享列表 + tags: + - assistant + post: + consumes: + - application/json + description: 此方法将会获取一个 Token,用户将会通过这个 Token 来访问你的 Assistant 并调用工具。 + parameters: + - in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.AssistantShare' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 创建 Assistant 共享 + tags: + - assistant + /api/v1/assistants/{id}/shares/{share_id}: + delete: + consumes: + - application/json + description: 此方法将会删除共享,删除后,共享将会立即失效。 + parameters: + - in: path + name: id + required: true + type: integer + - in: path + name: share_id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/schema.ResponseBody' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 删除 Assistant 共享 + tags: + - assistant + /api/v1/assistants/{id}/tools: + get: + consumes: + - application/json + parameters: + - description: Assistant ID + 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.AssistantTool' + type: array + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 获取 Assistant 所绑定的 Tool + tags: + - assistant + /api/v1/assistants/{id}/tools/{tool_id}: + delete: + consumes: + - application/json + parameters: + - description: Assistant ID + in: path + name: id + required: true + type: integer + - description: Tool ID + in: path + name: tool_id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.AssistantTool' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 解绑 Tool + tags: + - assistant + post: + consumes: + - application/json + parameters: + - description: Assistant ID + in: path + name: id + required: true + type: integer + - description: Tool ID + in: path + name: tool_id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.AssistantTool' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 绑定 Tool + tags: + - assistant + /api/v1/chat_public: + get: + consumes: + - application/json + parameters: + - description: ChatPublicListRequest + in: body + name: schema.ChatPublicListRequest + required: true + schema: + $ref: '#/definitions/schema.ChatPublicListRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.Chat' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + summary: 获取公开对话 + tags: + - chat_public + post: + consumes: + - application/json + parameters: + - description: ChatPublicRequest + in: body + name: schema.ChatPublicRequest + required: true + schema: + $ref: '#/definitions/schema.ChatPublicRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Chat' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + summary: 通过 API 创建一个公开的对话记录 + tags: + - chat_public + /api/v1/chat_public/{chat_id}/clear: + post: + consumes: + - application/json + parameters: + - in: path + name: chat_id + required: true + type: integer + - description: GetPublicChatMessageRequest + in: body + name: schema.GetPublicChatMessageRequest + required: true + schema: + $ref: '#/definitions/schema.GetPublicChatMessageRequest' + produces: + - application/json + responses: + "200": + description: OK + "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' + summary: 清空公开对话的聊天记录 + tags: + - chat_public + /api/v1/chat_public/{chat_id}/images: + post: + consumes: + - application/json + description: 将一个图片添加到聊天记录中 + parameters: + - in: path + name: chat_id + required: true + type: integer + - in: formData + name: assistant_token + required: true + type: string + - in: formData + name: guest_id + required: true + type: string + - in: formData + name: url + required: true + type: string + - description: 图片 + in: formData + name: image + type: file + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + "409": + description: Conflict + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + summary: 添加图片 + tags: + - chat_public + /api/v1/chat_public/{chat_id}/messages: + get: + consumes: + - application/json + parameters: + - in: path + name: chat_id + required: true + type: integer + - in: query + name: assistant_token + required: true + type: string + - in: query + name: guest_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.ChatMessage' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + summary: 获取公开对话的聊天记录 + tags: + - chat_public + post: + consumes: + - application/json + parameters: + - in: path + name: chat_id + required: true + type: integer + - description: AddPublicChatMessageRequest + in: body + name: schema.AddPublicChatMessageRequest + required: true + schema: + $ref: '#/definitions/schema.AddPublicChatMessageRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + "409": + description: Conflict + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + summary: 增加公开对话的聊天记录 + tags: + - chat_public + /api/v1/chats: + get: + consumes: + - application/json + description: get string by ID + parameters: + - description: Assistant ID + in: query + name: assistant_id + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.Chat' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 获取所有 Chat + tags: + - chat + post: + consumes: + - application/json + description: get string by ID + parameters: + - description: Chat + in: body + name: chat + required: true + schema: + $ref: '#/definitions/schema.ChatCreateRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Chat' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: Create Chat + tags: + - chat + /api/v1/chats/{id}: + delete: + consumes: + - application/json + description: get string by ID + parameters: + - description: Chat ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/schema.ResponseBody' + "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: Delete Chat + tags: + - chat + /api/v1/chats/{id}/clear: + post: + consumes: + - application/json + description: 清空当前聊天记录 + parameters: + - in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + "409": + description: Conflict + schema: + $ref: '#/definitions/schema.ResponseBody' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 清空聊天记录 + tags: + - chat_message + /api/v1/chats/{id}/files: + post: + consumes: + - application/json + description: 将一个文件添加到聊天记录中 + parameters: + - in: path + name: id + required: true + type: integer + - in: formData + name: url + required: true + type: string + - description: 文件 + in: formData + name: file + type: file + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + "409": + description: Conflict + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 添加文件 + tags: + - chat_message + /api/v1/chats/{id}/messages: + get: + consumes: + - application/json + description: get string by ID + 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.ChatMessage' + type: array + 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 + post: + consumes: + - application/json + description: get string by ID + parameters: + - in: path + name: id + required: true + type: integer + - description: Message + in: body + name: message + required: true + schema: + $ref: '#/definitions/schema.ChatMessageAddRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + "409": + description: Conflict + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 添加聊天记录 + tags: + - chat_message + /api/v1/files/{id}/download: + get: + consumes: + - application/json + description: 根据 File ID 下载文件。如果文件是私有的,将无法下载 + parameters: + - in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + type: file + summary: 下载公开文件 + tags: + - file + /api/v1/files/user/{id}/download: + get: + consumes: + - application/json + description: 根据 File ID 下载文件。如果文件是私有的,将无法下载 + parameters: + - in: path + name: id + required: true + type: integer + - in: query + name: id_token + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + type: file + summary: 下载用户开文件 + tags: + - file + /api/v1/libraries: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.Library' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 获取所有的资料库 + tags: + - libraries + post: + consumes: + - application/json + parameters: + - description: schema.LibraryCreateRequest + in: body + name: schema.LibraryCreateRequest + required: true + schema: + $ref: '#/definitions/schema.LibraryCreateRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Library' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 创建一个资料库 + tags: + - libraries + /api/v1/libraries/{id}: + delete: + consumes: + - application/json + parameters: + - in: path + name: id + type: integer + produces: + - application/json + responses: + "204": + description: No Content + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 删除资料库 + tags: + - libraries + get: + consumes: + - application/json + parameters: + - in: path + name: id + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.Library' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 获取一个资料库 + tags: + - libraries + patch: + consumes: + - application/json + parameters: + - in: path + name: id + type: integer + - description: schema.LibraryUpdateRequest + in: body + name: schema.LibraryUpdateRequest + required: true + schema: + $ref: '#/definitions/schema.LibraryUpdateRequest' + produces: + - application/json + responses: + "204": + description: No Content + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 更新资料库 + tags: + - libraries + /api/v1/libraries/{id}/documents: + get: + consumes: + - application/json + parameters: + - in: path + name: id + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.Document' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 列出资料库以及资料库下的文档 + tags: + - libraries + /api/v1/libraries/{id}/documents/{document_id}: + delete: + consumes: + - application/json + parameters: + - in: path + name: document_id + type: integer + - in: path + name: id + type: integer + produces: + - application/json + responses: + "204": + description: No Content + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 删除指定的文档 + tags: + - libraries + /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: + - application/json + description: get string by ID + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.CurrentUserResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: Greet + tags: + - ping + /api/v1/stream/{stream_id}: + get: + consumes: + - application/json + description: get string by ID + parameters: + - description: 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 + Prompt 选项 + in: header + name: X-User-IP + type: string + - description: Chat stream id + in: path + name: stream_id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + "409": + description: Conflict + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/schema.ChatMessageResponse' + type: object + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - none: [] + summary: 流式传输聊天内容 + tags: + - chat_message + /api/v1/tools: + get: + consumes: + - application/json + description: List tools + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + items: + $ref: '#/definitions/entity.Tool' + type: array + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: List Tool + tags: + - tool + post: + consumes: + - application/json + description: Create tool + parameters: + - description: Tool + in: body + name: tool + required: true + schema: + $ref: '#/definitions/schema.ToolCreateRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Tool' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: Create Tool + tags: + - tool + /api/v1/tools/{id}: + delete: + consumes: + - application/json + description: DeleteTool + parameters: + - description: Tool ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: DeleteTool + tags: + - tool + get: + consumes: + - application/json + description: Get tool + parameters: + - description: Tool ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Tool' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: Get Tool + tags: + - tool + /api/v1/tools/{id}/update: + post: + consumes: + - application/json + description: 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + parameters: + - description: Tool ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/schema.ResponseBody' + - properties: + data: + $ref: '#/definitions/entity.Tool' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + "404": + description: Not Found + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 更新 Tool 的数据 + tags: + - tool + /api/v1/tools/syntax: + post: + consumes: + - application/json + description: 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + parameters: + - description: ToolDiscoveryInput + in: body + name: toolDiscoveryInput + required: true + schema: + $ref: '#/definitions/schema.ToolDiscoveryInput' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/schema.ResponseBody' + "400": + description: Bad Request + schema: + $ref: '#/definitions/schema.ResponseBody' + security: + - ApiKeyAuth: [] + summary: 校验 Discovery 语法 + tags: + - tool +securityDefinitions: + ApiKeyAuth: + in: header + name: Authorization + type: apiKey +swagger: "2.0" diff --git a/index.html b/index.html new file mode 100644 index 0000000..8e7aa1d --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + amber-wails + + +
+ + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..3a36922 --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build2": "vue-tsc --noEmit && vite build", + "build": "vite build", + "preview": "vite preview", + "gen": "openapi-generator-cli generate -i ./api/swagger.yaml -g typescript-axios -o ./src/api" + }, + "dependencies": { + "axios": "^1.7.7", + "highlight.js": "^11.10.0", + "js-base64": "^3.7.7", + "lottie-web": "^5.12.2", + "pinia": "^2.2.2", + "pinia-plugin-persistedstate": "^4.0.0", + "vooks": "^0.2.12", + "vue": "^3.2.37", + "vue-router": "^4.0.13" + }, + "devDependencies": { + "@babel/types": "^7.18.10", + "@types/node": "^22.5.4", + "@vicons/ionicons5": "^0.12.0", + "@vicons/material": "^0.12.0", + "@vitejs/plugin-vue": "^5.0.5", + "@vue/eslint-config-prettier": "^9.0.0", + "@vue/eslint-config-typescript": "^13.0.0", + "autoprefixer": "^10.4.20", + "eslint": "^8.57.0", + "eslint-plugin-vue": "^9.26.0", + "naive-ui": "^2.39.0", + "postcss": "^8.4.45", + "prettier": "^3.3.2", + "tailwindcss": "^3.4.10", + "typescript": "^5.5.2", + "unplugin-auto-import": "^0.18.2", + "unplugin-vue-components": "^0.27.4", + "unplugin-vue-router": "^0.10.7", + "vfonts": "^0.0.3", + "vite": "^5.3.1", + "vite-plugin-pages": "^0.32.3", + "vite-plugin-vue-layouts": "^0.11.0", + "vue": "^3.4.30", + "vue-tsc": "^2.0.22" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..e76126d --- /dev/null +++ b/src/App.vue @@ -0,0 +1,117 @@ + + + + + + + + + + + + diff --git a/src/api/.gitignore b/src/api/.gitignore new file mode 100644 index 0000000..149b576 --- /dev/null +++ b/src/api/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/src/api/.npmignore b/src/api/.npmignore new file mode 100644 index 0000000..999d88d --- /dev/null +++ b/src/api/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/src/api/.openapi-generator-ignore b/src/api/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/src/api/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/src/api/.openapi-generator/FILES b/src/api/.openapi-generator/FILES new file mode 100644 index 0000000..16b445e --- /dev/null +++ b/src/api/.openapi-generator/FILES @@ -0,0 +1,9 @@ +.gitignore +.npmignore +.openapi-generator-ignore +api.ts +base.ts +common.ts +configuration.ts +git_push.sh +index.ts diff --git a/src/api/.openapi-generator/VERSION b/src/api/.openapi-generator/VERSION new file mode 100644 index 0000000..09a6d30 --- /dev/null +++ b/src/api/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.8.0 diff --git a/src/api/api.ts b/src/api/api.ts new file mode 100644 index 0000000..3e6f9a2 --- /dev/null +++ b/src/api/api.ts @@ -0,0 +1,5854 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Leaflow Amber + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base'; + +/** + * + * @export + * @interface ApiV1AssistantsGet200Response + */ +export interface ApiV1AssistantsGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1AssistantsGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1AssistantsGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1AssistantsGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1AssistantsGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1AssistantsIdSharesGet200Response + */ +export interface ApiV1AssistantsIdSharesGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1AssistantsIdSharesGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdSharesGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdSharesGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1AssistantsIdSharesGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1AssistantsIdSharesPost200Response + */ +export interface ApiV1AssistantsIdSharesPost200Response { + /** + * + * @type {EntityAssistantShare} + * @memberof ApiV1AssistantsIdSharesPost200Response + */ + 'data'?: EntityAssistantShare; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdSharesPost200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdSharesPost200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1AssistantsIdSharesPost200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1AssistantsIdToolsGet200Response + */ +export interface ApiV1AssistantsIdToolsGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1AssistantsIdToolsGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdToolsGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdToolsGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1AssistantsIdToolsGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1AssistantsIdToolsToolIdPost200Response + */ +export interface ApiV1AssistantsIdToolsToolIdPost200Response { + /** + * + * @type {EntityAssistantTool} + * @memberof ApiV1AssistantsIdToolsToolIdPost200Response + */ + 'data'?: EntityAssistantTool; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdToolsToolIdPost200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1AssistantsIdToolsToolIdPost200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1AssistantsIdToolsToolIdPost200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1AssistantsPost200Response + */ +export interface ApiV1AssistantsPost200Response { + /** + * + * @type {EntityAssistant} + * @memberof ApiV1AssistantsPost200Response + */ + 'data'?: EntityAssistant; + /** + * + * @type {string} + * @memberof ApiV1AssistantsPost200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1AssistantsPost200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1AssistantsPost200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1ChatPublicChatIdImagesPost200Response + */ +export interface ApiV1ChatPublicChatIdImagesPost200Response { + /** + * + * @type {SchemaChatMessageResponse} + * @memberof ApiV1ChatPublicChatIdImagesPost200Response + */ + 'data'?: SchemaChatMessageResponse; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicChatIdImagesPost200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicChatIdImagesPost200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1ChatPublicChatIdImagesPost200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1ChatPublicChatIdImagesPostRequest + */ +export interface ApiV1ChatPublicChatIdImagesPostRequest { + /** + * + * @type {string} + * @memberof ApiV1ChatPublicChatIdImagesPostRequest + */ + 'assistant_token': string; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicChatIdImagesPostRequest + */ + 'guest_id': string; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicChatIdImagesPostRequest + */ + 'url': string; + /** + * 图片 + * @type {File} + * @memberof ApiV1ChatPublicChatIdImagesPostRequest + */ + 'image'?: File; +} +/** + * + * @export + * @interface ApiV1ChatPublicChatIdMessagesGet200Response + */ +export interface ApiV1ChatPublicChatIdMessagesGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1ChatPublicChatIdMessagesGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicChatIdMessagesGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicChatIdMessagesGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1ChatPublicChatIdMessagesGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1ChatPublicGet200Response + */ +export interface ApiV1ChatPublicGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1ChatPublicGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1ChatPublicGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1ChatPublicPost200Response + */ +export interface ApiV1ChatPublicPost200Response { + /** + * + * @type {EntityChat} + * @memberof ApiV1ChatPublicPost200Response + */ + 'data'?: EntityChat; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicPost200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1ChatPublicPost200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1ChatPublicPost200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1ChatsIdFilesPostRequest + */ +export interface ApiV1ChatsIdFilesPostRequest { + /** + * + * @type {string} + * @memberof ApiV1ChatsIdFilesPostRequest + */ + 'url': string; + /** + * 文件 + * @type {File} + * @memberof ApiV1ChatsIdFilesPostRequest + */ + 'file'?: File; +} +/** + * + * @export + * @interface ApiV1LibrariesGet200Response + */ +export interface ApiV1LibrariesGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1LibrariesGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1LibrariesGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1LibrariesGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1LibrariesGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1LibrariesIdDocumentsGet200Response + */ +export interface ApiV1LibrariesIdDocumentsGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1LibrariesIdDocumentsGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1LibrariesIdDocumentsGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1LibrariesIdDocumentsGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1LibrariesIdDocumentsGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1LibrariesPost201Response + */ +export interface ApiV1LibrariesPost201Response { + /** + * + * @type {EntityLibrary} + * @memberof ApiV1LibrariesPost201Response + */ + 'data'?: EntityLibrary; + /** + * + * @type {string} + * @memberof ApiV1LibrariesPost201Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1LibrariesPost201Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1LibrariesPost201Response + */ + 'success'?: boolean; +} +/** + * + * @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 + * @interface ApiV1PingGet200Response + */ +export interface ApiV1PingGet200Response { + /** + * + * @type {SchemaCurrentUserResponse} + * @memberof ApiV1PingGet200Response + */ + 'data'?: SchemaCurrentUserResponse; + /** + * + * @type {string} + * @memberof ApiV1PingGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1PingGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1PingGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1ToolsGet200Response + */ +export interface ApiV1ToolsGet200Response { + /** + * + * @type {Array} + * @memberof ApiV1ToolsGet200Response + */ + 'data'?: Array; + /** + * + * @type {string} + * @memberof ApiV1ToolsGet200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1ToolsGet200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1ToolsGet200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ApiV1ToolsPost200Response + */ +export interface ApiV1ToolsPost200Response { + /** + * + * @type {EntityTool} + * @memberof ApiV1ToolsPost200Response + */ + 'data'?: EntityTool; + /** + * + * @type {string} + * @memberof ApiV1ToolsPost200Response + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof ApiV1ToolsPost200Response + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof ApiV1ToolsPost200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface EntityAssistant + */ +export interface EntityAssistant { + /** + * + * @type {string} + * @memberof EntityAssistant + */ + 'created_at'?: string; + /** + * + * @type {string} + * @memberof EntityAssistant + */ + 'description'?: string; + /** + * + * @type {boolean} + * @memberof EntityAssistant + */ + 'disable_default_prompt'?: boolean; + /** + * + * @type {boolean} + * @memberof EntityAssistant + */ + 'disable_memory'?: boolean; + /** + * + * @type {boolean} + * @memberof EntityAssistant + */ + 'enable_memory_for_assistant_share'?: boolean; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityAssistant + */ + 'id'?: number; + /** + * + * @type {EntityLibrary} + * @memberof EntityAssistant + */ + 'library'?: EntityLibrary; + /** + * + * @type {number} + * @memberof EntityAssistant + */ + 'library_id'?: number; + /** + * + * @type {string} + * @memberof EntityAssistant + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof EntityAssistant + */ + 'prompt'?: string; + /** + * + * @type {string} + * @memberof EntityAssistant + */ + 'updated_at'?: string; + /** + * + * @type {string} + * @memberof EntityAssistant + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface EntityAssistantShare + */ +export interface EntityAssistantShare { + /** + * + * @type {EntityAssistant} + * @memberof EntityAssistantShare + */ + 'assistant'?: EntityAssistant; + /** + * + * @type {number} + * @memberof EntityAssistantShare + */ + 'assistant_id'?: number; + /** + * + * @type {string} + * @memberof EntityAssistantShare + */ + 'created_at'?: string; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityAssistantShare + */ + 'id'?: number; + /** + * + * @type {string} + * @memberof EntityAssistantShare + */ + 'token'?: string; + /** + * + * @type {string} + * @memberof EntityAssistantShare + */ + 'updated_at'?: string; +} +/** + * + * @export + * @interface EntityAssistantTool + */ +export interface EntityAssistantTool { + /** + * + * @type {EntityAssistant} + * @memberof EntityAssistantTool + */ + 'assistant'?: EntityAssistant; + /** + * + * @type {number} + * @memberof EntityAssistantTool + */ + 'assistant_id'?: number; + /** + * + * @type {string} + * @memberof EntityAssistantTool + */ + 'created_at'?: string; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityAssistantTool + */ + 'id'?: number; + /** + * + * @type {EntityTool} + * @memberof EntityAssistantTool + */ + 'tool'?: EntityTool; + /** + * + * @type {number} + * @memberof EntityAssistantTool + */ + 'tool_id'?: number; + /** + * + * @type {string} + * @memberof EntityAssistantTool + */ + 'updated_at'?: string; +} +/** + * + * @export + * @interface EntityChat + */ +export interface EntityChat { + /** + * + * @type {number} + * @memberof EntityChat + */ + 'assistant_id'?: number; + /** + * + * @type {string} + * @memberof EntityChat + */ + 'created_at'?: string; + /** + * + * @type {string} + * @memberof EntityChat + */ + 'expired_at'?: string; + /** + * + * @type {string} + * @memberof EntityChat + */ + 'guest_id'?: string; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityChat + */ + 'id'?: number; + /** + * + * @type {string} + * @memberof EntityChat + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof EntityChat + */ + 'owner'?: string; + /** + * + * @type {string} + * @memberof EntityChat + */ + 'updated_at'?: string; + /** + * + * @type {string} + * @memberof EntityChat + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface EntityChatMessage + */ +export interface EntityChatMessage { + /** + * + * @type {number} + * @memberof EntityChatMessage + */ + 'assistant_id'?: number; + /** + * + * @type {number} + * @memberof EntityChatMessage + */ + 'completion_tokens'?: number; + /** + * + * @type {string} + * @memberof EntityChatMessage + */ + 'content'?: string; + /** + * + * @type {string} + * @memberof EntityChatMessage + */ + 'created_at'?: string; + /** + * + * @type {EntityFile} + * @memberof EntityChatMessage + */ + 'file'?: EntityFile; + /** + * FileId 虽然有了 UserFileId, 但是 File Id 还是应该保留,因为这个是针对访客用户的 + * @type {number} + * @memberof EntityChatMessage + */ + 'file_id'?: number; + /** + * + * @type {boolean} + * @memberof EntityChatMessage + */ + 'hidden'?: boolean; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityChatMessage + */ + 'id'?: number; + /** + * + * @type {number} + * @memberof EntityChatMessage + */ + 'prompt_tokens'?: number; + /** + * + * @type {string} + * @memberof EntityChatMessage + */ + 'role'?: string; + /** + * + * @type {number} + * @memberof EntityChatMessage + */ + 'total_tokens'?: number; + /** + * + * @type {string} + * @memberof EntityChatMessage + */ + 'updated_at'?: string; + /** + * + * @type {EntityUserFile} + * @memberof EntityChatMessage + */ + 'user_file'?: EntityUserFile; + /** + * + * @type {number} + * @memberof EntityChatMessage + */ + 'user_file_id'?: number; +} +/** + * + * @export + * @interface EntityDocument + */ +export interface EntityDocument { + /** + * + * @type {boolean} + * @memberof EntityDocument + */ + 'chunked'?: boolean; + /** + * + * @type {string} + * @memberof EntityDocument + */ + 'created_at'?: string; + /** + * + * @type {EntityFile} + * @memberof EntityDocument + */ + 'file'?: EntityFile; + /** + * FileHash 是 File 结构体的 hash,用于判断文件内容是否发生变化 只不过一般情况也不会改变,因为 File 就不会变 + * @type {string} + * @memberof EntityDocument + */ + 'file_hash'?: string; + /** + * + * @type {number} + * @memberof EntityDocument + */ + 'file_id'?: number; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityDocument + */ + 'id'?: number; + /** + * + * @type {EntityLibrary} + * @memberof EntityDocument + */ + 'library'?: EntityLibrary; + /** + * + * @type {number} + * @memberof EntityDocument + */ + 'library_id'?: number; + /** + * + * @type {string} + * @memberof EntityDocument + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof EntityDocument + */ + 'updated_at'?: string; +} +/** + * + * @export + * @interface EntityFile + */ +export interface EntityFile { + /** + * + * @type {string} + * @memberof EntityFile + */ + 'created_at'?: string; + /** + * TODO: 移除 file 的到期时间,如果当 file 没有任何引用的时候再删除 因为有外键,所以直接删除是删不掉的,必须删除消息 + * @type {string} + * @memberof EntityFile + */ + 'expired_at'?: string; + /** + * + * @type {string} + * @memberof EntityFile + */ + 'file_hash'?: string; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityFile + */ + 'id'?: number; + /** + * + * @type {string} + * @memberof EntityFile + */ + 'mime_type'?: string; + /** + * + * @type {string} + * @memberof EntityFile + */ + 'path'?: string; + /** + * 是否公开,访客上传的文件应始终公开,或归属于所有者 + * @type {boolean} + * @memberof EntityFile + */ + 'public'?: boolean; + /** + * + * @type {number} + * @memberof EntityFile + */ + 'size'?: number; + /** + * + * @type {string} + * @memberof EntityFile + */ + 'updated_at'?: string; + /** + * + * @type {string} + * @memberof EntityFile + */ + 'url'?: string; + /** + * + * @type {string} + * @memberof EntityFile + */ + 'url_hash'?: string; +} +/** + * + * @export + * @interface EntityLibrary + */ +export interface EntityLibrary { + /** + * + * @type {string} + * @memberof EntityLibrary + */ + 'created_at'?: string; + /** + * + * @type {boolean} + * @memberof EntityLibrary + */ + 'default'?: boolean; + /** + * + * @type {string} + * @memberof EntityLibrary + */ + 'description'?: string; + /** + * + * @type {Array} + * @memberof EntityLibrary + */ + 'documents'?: Array; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityLibrary + */ + 'id'?: number; + /** + * + * @type {string} + * @memberof EntityLibrary + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof EntityLibrary + */ + 'updated_at'?: string; + /** + * + * @type {string} + * @memberof EntityLibrary + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface EntityMemory + */ +export interface EntityMemory { + /** + * + * @type {string} + * @memberof EntityMemory + */ + 'content'?: string; + /** + * + * @type {string} + * @memberof EntityMemory + */ + 'created_at'?: string; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityMemory + */ + 'id'?: number; + /** + * + * @type {string} + * @memberof EntityMemory + */ + 'updated_at'?: string; + /** + * + * @type {string} + * @memberof EntityMemory + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface EntityTool + */ +export interface EntityTool { + /** + * + * @type {string} + * @memberof EntityTool + */ + 'api_key'?: string; + /** + * + * @type {string} + * @memberof EntityTool + */ + 'created_at'?: string; + /** + * + * @type {SchemaToolDiscoveryOutput} + * @memberof EntityTool + */ + 'data'?: SchemaToolDiscoveryOutput; + /** + * + * @type {string} + * @memberof EntityTool + */ + 'description'?: string; + /** + * + * @type {string} + * @memberof EntityTool + */ + 'discovery_url'?: string; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityTool + */ + 'id'?: number; + /** + * + * @type {string} + * @memberof EntityTool + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof EntityTool + */ + 'updated_at'?: string; + /** + * + * @type {string} + * @memberof EntityTool + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface EntityUserFile + */ +export interface EntityUserFile { + /** + * + * @type {string} + * @memberof EntityUserFile + */ + 'created_at'?: string; + /** + * + * @type {EntityFile} + * @memberof EntityUserFile + */ + 'file'?: EntityFile; + /** + * + * @type {number} + * @memberof EntityUserFile + */ + 'file_id'?: number; + /** + * Id schema.EntityId `gorm:\"primarykey\" json:\"id,string\"` + * @type {number} + * @memberof EntityUserFile + */ + 'id'?: number; + /** + * + * @type {string} + * @memberof EntityUserFile + */ + 'updated_at'?: string; + /** + * + * @type {string} + * @memberof EntityUserFile + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface SchemaAddPublicChatMessageRequest + */ +export interface SchemaAddPublicChatMessageRequest { + /** + * + * @type {string} + * @memberof SchemaAddPublicChatMessageRequest + */ + 'assistant_token': string; + /** + * + * @type {string} + * @memberof SchemaAddPublicChatMessageRequest + */ + 'guest_id': string; + /** + * + * @type {string} + * @memberof SchemaAddPublicChatMessageRequest + */ + 'message': string; + /** + * + * @type {string} + * @memberof SchemaAddPublicChatMessageRequest + */ + 'role': SchemaAddPublicChatMessageRequestRoleEnum; +} + +export const SchemaAddPublicChatMessageRequestRoleEnum = { + User: 'user', + UserHide: 'user_hide', + System: 'system', + SystemHide: 'system_hide', + Assistant: 'assistant' +} as const; + +export type SchemaAddPublicChatMessageRequestRoleEnum = typeof SchemaAddPublicChatMessageRequestRoleEnum[keyof typeof SchemaAddPublicChatMessageRequestRoleEnum]; + +/** + * + * @export + * @interface SchemaAssistantCreateRequest + */ +export interface SchemaAssistantCreateRequest { + /** + * + * @type {string} + * @memberof SchemaAssistantCreateRequest + */ + 'description': string; + /** + * + * @type {boolean} + * @memberof SchemaAssistantCreateRequest + */ + 'disable_default_prompt'?: boolean; + /** + * + * @type {string} + * @memberof SchemaAssistantCreateRequest + */ + 'name': string; + /** + * + * @type {string} + * @memberof SchemaAssistantCreateRequest + */ + 'prompt'?: string; +} +/** + * + * @export + * @interface SchemaAssistantLibraryRequest + */ +export interface SchemaAssistantLibraryRequest { + /** + * + * @type {number} + * @memberof SchemaAssistantLibraryRequest + */ + 'library_id': number; +} +/** + * + * @export + * @interface SchemaAssistantUpdateRequest + */ +export interface SchemaAssistantUpdateRequest { + /** + * + * @type {string} + * @memberof SchemaAssistantUpdateRequest + */ + 'description'?: string; + /** + * + * @type {boolean} + * @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} + * @memberof SchemaAssistantUpdateRequest + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof SchemaAssistantUpdateRequest + */ + 'prompt'?: string; +} +/** + * + * @export + * @interface SchemaChatCreateRequest + */ +export interface SchemaChatCreateRequest { + /** + * + * @type {number} + * @memberof SchemaChatCreateRequest + */ + 'assistant_id': number; + /** + * + * @type {SchemaCustomTime} + * @memberof SchemaChatCreateRequest + */ + 'expired_at'?: SchemaCustomTime; + /** + * + * @type {string} + * @memberof SchemaChatCreateRequest + */ + 'name': string; +} +/** + * + * @export + * @interface SchemaChatMessageAddRequest + */ +export interface SchemaChatMessageAddRequest { + /** + * + * @type {string} + * @memberof SchemaChatMessageAddRequest + */ + 'message': string; + /** + * + * @type {string} + * @memberof SchemaChatMessageAddRequest + */ + 'role': SchemaChatMessageAddRequestRoleEnum; +} + +export const SchemaChatMessageAddRequestRoleEnum = { + User: 'user', + UserHide: 'user_hide', + System: 'system', + SystemHide: 'system_hide', + Assistant: 'assistant', + Image: 'image' +} as const; + +export type SchemaChatMessageAddRequestRoleEnum = typeof SchemaChatMessageAddRequestRoleEnum[keyof typeof SchemaChatMessageAddRequestRoleEnum]; + +/** + * + * @export + * @interface SchemaChatMessageResponse + */ +export interface SchemaChatMessageResponse { + /** + * + * @type {boolean} + * @memberof SchemaChatMessageResponse + */ + 'stream'?: boolean; + /** + * + * @type {string} + * @memberof SchemaChatMessageResponse + */ + 'stream_id'?: string; +} +/** + * + * @export + * @interface SchemaChatPublicListRequest + */ +export interface SchemaChatPublicListRequest { + /** + * + * @type {string} + * @memberof SchemaChatPublicListRequest + */ + 'guest_id': string; +} +/** + * + * @export + * @interface SchemaChatPublicRequest + */ +export interface SchemaChatPublicRequest { + /** + * + * @type {string} + * @memberof SchemaChatPublicRequest + */ + 'assistant_token': string; + /** + * + * @type {string} + * @memberof SchemaChatPublicRequest + */ + 'guest_id': string; + /** + * + * @type {string} + * @memberof SchemaChatPublicRequest + */ + 'name': string; +} +/** + * + * @export + * @interface SchemaCurrentUserResponse + */ +export interface SchemaCurrentUserResponse { + /** + * + * @type {string} + * @memberof SchemaCurrentUserResponse + */ + 'ip'?: string; + /** + * + * @type {string} + * @memberof SchemaCurrentUserResponse + */ + 'userEmail'?: string; + /** + * + * @type {string} + * @memberof SchemaCurrentUserResponse + */ + 'userId'?: string; + /** + * + * @type {string} + * @memberof SchemaCurrentUserResponse + */ + 'userName'?: string; + /** + * + * @type {boolean} + * @memberof SchemaCurrentUserResponse + */ + 'valid'?: boolean; +} +/** + * + * @export + * @interface SchemaCustomTime + */ +export interface SchemaCustomTime { + /** + * + * @type {string} + * @memberof SchemaCustomTime + */ + 'time.Time'?: string; +} +/** + * + * @export + * @interface SchemaFunctionsInput + */ +export interface SchemaFunctionsInput { + /** + * + * @type {string} + * @memberof SchemaFunctionsInput + */ + 'description': string; + /** + * + * @type {string} + * @memberof SchemaFunctionsInput + */ + 'name': string; + /** + * + * @type {SchemaToolDiscoveryOutputFunctionParameters} + * @memberof SchemaFunctionsInput + */ + 'parameters': SchemaToolDiscoveryOutputFunctionParameters; +} +/** + * + * @export + * @interface SchemaGetPublicChatMessageRequest + */ +export interface SchemaGetPublicChatMessageRequest { + /** + * + * @type {string} + * @memberof SchemaGetPublicChatMessageRequest + */ + 'assistant_token': string; + /** + * + * @type {string} + * @memberof SchemaGetPublicChatMessageRequest + */ + 'guest_id': string; +} +/** + * + * @export + * @interface SchemaLibraryCreateRequest + */ +export interface SchemaLibraryCreateRequest { + /** + * + * @type {string} + * @memberof SchemaLibraryCreateRequest + */ + 'description'?: string; + /** + * + * @type {string} + * @memberof SchemaLibraryCreateRequest + */ + 'name': string; +} +/** + * + * @export + * @interface SchemaLibraryUpdateRequest + */ +export interface SchemaLibraryUpdateRequest { + /** + * + * @type {boolean} + * @memberof SchemaLibraryUpdateRequest + */ + 'default'?: boolean; + /** + * + * @type {string} + * @memberof SchemaLibraryUpdateRequest + */ + 'description'?: string; + /** + * + * @type {string} + * @memberof SchemaLibraryUpdateRequest + */ + 'name': string; +} +/** + * + * @export + * @interface SchemaOpenAIChatCompletionRequest + */ +export interface SchemaOpenAIChatCompletionRequest { + /** + * Optional + * @type {number} + * @memberof SchemaOpenAIChatCompletionRequest + */ + 'max_tokens'?: number; + /** + * Required + * @type {Array} + * @memberof SchemaOpenAIChatCompletionRequest + */ + 'messages'?: Array; + /** + * Required + * @type {string} + * @memberof SchemaOpenAIChatCompletionRequest + */ + 'model'?: string; + /** + * Optional + * @type {number} + * @memberof SchemaOpenAIChatCompletionRequest + */ + 'n'?: number; + /** + * Optional + * @type {boolean} + * @memberof SchemaOpenAIChatCompletionRequest + */ + 'stream'?: boolean; + /** + * Optional + * @type {number} + * @memberof SchemaOpenAIChatCompletionRequest + */ + 'temperature'?: number; + /** + * Optional + * @type {number} + * @memberof SchemaOpenAIChatCompletionRequest + */ + 'top_p'?: number; +} +/** + * + * @export + * @interface SchemaOpenAIChatCompletionRequestMessage + */ +export interface SchemaOpenAIChatCompletionRequestMessage { + /** + * Required + * @type {object} + * @memberof SchemaOpenAIChatCompletionRequestMessage + */ + 'content'?: object; + /** + * + * @type {SchemaOpenAIImageUrl} + * @memberof SchemaOpenAIChatCompletionRequestMessage + */ + 'image_url'?: SchemaOpenAIImageUrl; + /** + * Required + * @type {string} + * @memberof SchemaOpenAIChatCompletionRequestMessage + */ + 'role'?: string; +} +/** + * + * @export + * @interface SchemaOpenAIChatCompletionResponse + */ +export interface SchemaOpenAIChatCompletionResponse { + /** + * + * @type {Array} + * @memberof SchemaOpenAIChatCompletionResponse + */ + 'choices'?: Array; + /** + * + * @type {number} + * @memberof SchemaOpenAIChatCompletionResponse + */ + 'created'?: number; + /** + * + * @type {string} + * @memberof SchemaOpenAIChatCompletionResponse + */ + 'id'?: string; + /** + * + * @type {string} + * @memberof SchemaOpenAIChatCompletionResponse + */ + 'model'?: string; + /** + * + * @type {string} + * @memberof SchemaOpenAIChatCompletionResponse + */ + 'object'?: string; + /** + * + * @type {SchemaTokenUsage} + * @memberof SchemaOpenAIChatCompletionResponse + */ + 'usage'?: SchemaTokenUsage; +} +/** + * + * @export + * @interface SchemaOpenAIChatCompletionResponseChoice + */ +export interface SchemaOpenAIChatCompletionResponseChoice { + /** + * + * @type {number} + * @memberof SchemaOpenAIChatCompletionResponseChoice + */ + 'index'?: number; + /** + * + * @type {SchemaOpenAIChatCompletionRequestMessage} + * @memberof SchemaOpenAIChatCompletionResponseChoice + */ + 'message'?: SchemaOpenAIChatCompletionRequestMessage; +} +/** + * + * @export + * @interface SchemaOpenAIImageUrl + */ +export interface SchemaOpenAIImageUrl { + /** + * + * @type {string} + * @memberof SchemaOpenAIImageUrl + */ + 'detail'?: string; + /** + * + * @type {string} + * @memberof SchemaOpenAIImageUrl + */ + 'url'?: string; +} +/** + * + * @export + * @interface SchemaResponseBody + */ +export interface SchemaResponseBody { + /** + * + * @type {object} + * @memberof SchemaResponseBody + */ + 'data'?: object; + /** + * + * @type {string} + * @memberof SchemaResponseBody + */ + 'error'?: string; + /** + * + * @type {string} + * @memberof SchemaResponseBody + */ + 'message'?: string; + /** + * + * @type {boolean} + * @memberof SchemaResponseBody + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface SchemaTokenUsage + */ +export interface SchemaTokenUsage { + /** + * + * @type {number} + * @memberof SchemaTokenUsage + */ + 'completion_tokens'?: number; + /** + * + * @type {number} + * @memberof SchemaTokenUsage + */ + 'prompt_tokens'?: number; + /** + * + * @type {number} + * @memberof SchemaTokenUsage + */ + 'total_tokens'?: number; +} +/** + * + * @export + * @interface SchemaToolCreateRequest + */ +export interface SchemaToolCreateRequest { + /** + * + * @type {string} + * @memberof SchemaToolCreateRequest + */ + 'api_key'?: string; + /** + * + * @type {string} + * @memberof SchemaToolCreateRequest + */ + 'description': string; + /** + * + * @type {string} + * @memberof SchemaToolCreateRequest + */ + 'name': string; + /** + * + * @type {string} + * @memberof SchemaToolCreateRequest + */ + 'url': string; +} +/** + * + * @export + * @interface SchemaToolDiscoveryInput + */ +export interface SchemaToolDiscoveryInput { + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryInput + */ + 'callback_url'?: string; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryInput + */ + 'description': string; + /** + * + * @type {Array} + * @memberof SchemaToolDiscoveryInput + */ + 'functions'?: Array; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryInput + */ + 'homepage_url'?: string; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryInput + */ + 'name': string; +} +/** + * + * @export + * @interface SchemaToolDiscoveryOutput + */ +export interface SchemaToolDiscoveryOutput { + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutput + */ + 'callback_url'?: string; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutput + */ + 'description'?: string; + /** + * + * @type {Array} + * @memberof SchemaToolDiscoveryOutput + */ + 'function'?: Array; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutput + */ + 'homepage_url'?: string; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutput + */ + 'name'?: string; +} +/** + * + * @export + * @interface SchemaToolDiscoveryOutputFunction + */ +export interface SchemaToolDiscoveryOutputFunction { + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutputFunction + */ + 'description'?: string; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutputFunction + */ + 'name'?: string; + /** + * + * @type {SchemaToolDiscoveryOutputFunctionParameters} + * @memberof SchemaToolDiscoveryOutputFunction + */ + 'parameters'?: SchemaToolDiscoveryOutputFunctionParameters; +} +/** + * + * @export + * @interface SchemaToolDiscoveryOutputFunctionParameters + */ +export interface SchemaToolDiscoveryOutputFunctionParameters { + /** + * + * @type {object} + * @memberof SchemaToolDiscoveryOutputFunctionParameters + */ + 'properties': object; + /** + * + * @type {Array} + * @memberof SchemaToolDiscoveryOutputFunctionParameters + */ + 'required': Array; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutputFunctionParameters + */ + 'type': string; +} +/** + * + * @export + * @interface SchemaToolDiscoveryOutputFunctions + */ +export interface SchemaToolDiscoveryOutputFunctions { + /** + * + * @type {Array} + * @memberof SchemaToolDiscoveryOutputFunctions + */ + 'functions'?: Array; + /** + * + * @type {string} + * @memberof SchemaToolDiscoveryOutputFunctions + */ + 'type'?: string; +} + +/** + * AssistantApi - axios parameter creator + * @export + */ +export const AssistantApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary 获取 Assistant 列表 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsGet: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/assistants`; + // 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 删除 Assistant + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdDelete: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdDelete', 'id', id) + 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: '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 + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdGet', 'id', id) + 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: '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} + */ + apiV1AssistantsIdLibraryDelete: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdLibraryDelete', 'id', id) + const localVarPath = `/api/v1/assistants/{id}/library` + .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 {number} id + * @param {SchemaAssistantLibraryRequest} assistantLibraryRequest AssistantLibraryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdLibraryPost: async (id: number, assistantLibraryRequest: SchemaAssistantLibraryRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdLibraryPost', 'id', id) + // verify required parameter 'assistantLibraryRequest' is not null or undefined + assertParamExists('apiV1AssistantsIdLibraryPost', 'assistantLibraryRequest', assistantLibraryRequest) + const localVarPath = `/api/v1/assistants/{id}/library` + .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(assistantLibraryRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {SchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdPatch: async (id: number, assistantUpdateRequest: SchemaAssistantUpdateRequest, 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, + }; + }, + /** + * 此 API 可以创建一个 Assistant 共享 Token,可以将你的 Assistant 公开出去使用。 + * @summary 获取 Assistant 共享列表 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdSharesGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdSharesGet', 'id', id) + const localVarPath = `/api/v1/assistants/{id}/shares` + .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, + }; + }, + /** + * 此方法将会获取一个 Token,用户将会通过这个 Token 来访问你的 Assistant 并调用工具。 + * @summary 创建 Assistant 共享 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdSharesPost: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdSharesPost', 'id', id) + const localVarPath = `/api/v1/assistants/{id}/shares` + .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) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 此方法将会删除共享,删除后,共享将会立即失效。 + * @summary 删除 Assistant 共享 + * @param {number} id + * @param {number} shareId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdSharesShareIdDelete: async (id: number, shareId: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdSharesShareIdDelete', 'id', id) + // verify required parameter 'shareId' is not null or undefined + assertParamExists('apiV1AssistantsIdSharesShareIdDelete', 'shareId', shareId) + const localVarPath = `/api/v1/assistants/{id}/shares/{share_id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))) + .replace(`{${"share_id"}}`, encodeURIComponent(String(shareId))); + // 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 + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdToolsGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdToolsGet', 'id', id) + const localVarPath = `/api/v1/assistants/{id}/tools` + .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 解绑 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdToolsToolIdDelete: async (id: number, toolId: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdToolsToolIdDelete', 'id', id) + // verify required parameter 'toolId' is not null or undefined + assertParamExists('apiV1AssistantsIdToolsToolIdDelete', 'toolId', toolId) + const localVarPath = `/api/v1/assistants/{id}/tools/{tool_id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))) + .replace(`{${"tool_id"}}`, encodeURIComponent(String(toolId))); + // 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 绑定 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdToolsToolIdPost: async (id: number, toolId: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1AssistantsIdToolsToolIdPost', 'id', id) + // verify required parameter 'toolId' is not null or undefined + assertParamExists('apiV1AssistantsIdToolsToolIdPost', 'toolId', toolId) + const localVarPath = `/api/v1/assistants/{id}/tools/{tool_id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))) + .replace(`{${"tool_id"}}`, encodeURIComponent(String(toolId))); + // 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, + }; + }, + /** + * + * @summary 创建 Assistant + * @param {SchemaAssistantCreateRequest} assistant Assistant + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsPost: async (assistant: SchemaAssistantCreateRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'assistant' is not null or undefined + assertParamExists('apiV1AssistantsPost', 'assistant', assistant) + const localVarPath = `/api/v1/assistants`; + // 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(assistant, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * AssistantApi - functional programming interface + * @export + */ +export const AssistantApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = AssistantApiAxiosParamCreator(configuration) + return { + /** + * + * @summary 获取 Assistant 列表 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsGet(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 删除 Assistant + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdDelete(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdDelete(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdDelete']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 获取指定的 Assistant + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdGet']?.[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 apiV1AssistantsIdLibraryDelete(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdLibraryDelete(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdLibraryDelete']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 绑定资料库 + * @param {number} id + * @param {SchemaAssistantLibraryRequest} assistantLibraryRequest AssistantLibraryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdLibraryPost(id: number, assistantLibraryRequest: SchemaAssistantLibraryRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdLibraryPost(id, assistantLibraryRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdLibraryPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {SchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdPatch(id: number, assistantUpdateRequest: SchemaAssistantUpdateRequest, 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); + }, + /** + * 此 API 可以创建一个 Assistant 共享 Token,可以将你的 Assistant 公开出去使用。 + * @summary 获取 Assistant 共享列表 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdSharesGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdSharesGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdSharesGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 此方法将会获取一个 Token,用户将会通过这个 Token 来访问你的 Assistant 并调用工具。 + * @summary 创建 Assistant 共享 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdSharesPost(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdSharesPost(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdSharesPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 此方法将会删除共享,删除后,共享将会立即失效。 + * @summary 删除 Assistant 共享 + * @param {number} id + * @param {number} shareId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdSharesShareIdDelete(id: number, shareId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdSharesShareIdDelete(id, shareId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdSharesShareIdDelete']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 获取 Assistant 所绑定的 Tool + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdToolsGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdToolsGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdToolsGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 解绑 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdToolsToolIdDelete(id: number, toolId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdToolsToolIdDelete(id, toolId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdToolsToolIdDelete']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 绑定 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsIdToolsToolIdPost(id: number, toolId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsIdToolsToolIdPost(id, toolId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsIdToolsToolIdPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 创建 Assistant + * @param {SchemaAssistantCreateRequest} assistant Assistant + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1AssistantsPost(assistant: SchemaAssistantCreateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AssistantsPost(assistant, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssistantApi.apiV1AssistantsPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * AssistantApi - factory interface + * @export + */ +export const AssistantApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = AssistantApiFp(configuration) + return { + /** + * + * @summary 获取 Assistant 列表 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsGet(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsGet(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 删除 Assistant + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdDelete(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdDelete(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 获取指定的 Assistant + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 解绑资料库 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdLibraryDelete(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdLibraryDelete(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 绑定资料库 + * @param {number} id + * @param {SchemaAssistantLibraryRequest} assistantLibraryRequest AssistantLibraryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdLibraryPost(id: number, assistantLibraryRequest: SchemaAssistantLibraryRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdLibraryPost(id, assistantLibraryRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {SchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdPatch(id: number, assistantUpdateRequest: SchemaAssistantUpdateRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdPatch(id, assistantUpdateRequest, options).then((request) => request(axios, basePath)); + }, + /** + * 此 API 可以创建一个 Assistant 共享 Token,可以将你的 Assistant 公开出去使用。 + * @summary 获取 Assistant 共享列表 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdSharesGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdSharesGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * 此方法将会获取一个 Token,用户将会通过这个 Token 来访问你的 Assistant 并调用工具。 + * @summary 创建 Assistant 共享 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdSharesPost(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdSharesPost(id, options).then((request) => request(axios, basePath)); + }, + /** + * 此方法将会删除共享,删除后,共享将会立即失效。 + * @summary 删除 Assistant 共享 + * @param {number} id + * @param {number} shareId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdSharesShareIdDelete(id: number, shareId: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdSharesShareIdDelete(id, shareId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 获取 Assistant 所绑定的 Tool + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdToolsGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdToolsGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 解绑 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdToolsToolIdDelete(id: number, toolId: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdToolsToolIdDelete(id, toolId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 绑定 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsIdToolsToolIdPost(id: number, toolId: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsIdToolsToolIdPost(id, toolId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 创建 Assistant + * @param {SchemaAssistantCreateRequest} assistant Assistant + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1AssistantsPost(assistant: SchemaAssistantCreateRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1AssistantsPost(assistant, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * AssistantApi - object-oriented interface + * @export + * @class AssistantApi + * @extends {BaseAPI} + */ +export class AssistantApi extends BaseAPI { + /** + * + * @summary 获取 Assistant 列表 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsGet(options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsGet(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 删除 Assistant + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdDelete(id: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdDelete(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 获取指定的 Assistant + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdGet(id: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 解绑资料库 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdLibraryDelete(id: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdLibraryDelete(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 绑定资料库 + * @param {number} id + * @param {SchemaAssistantLibraryRequest} assistantLibraryRequest AssistantLibraryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdLibraryPost(id: number, assistantLibraryRequest: SchemaAssistantLibraryRequest, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdLibraryPost(id, assistantLibraryRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 更新 Assistant + * @param {number} id Assistant ID + * @param {SchemaAssistantUpdateRequest} assistantUpdateRequest Assistant Update + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdPatch(id: number, assistantUpdateRequest: SchemaAssistantUpdateRequest, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdPatch(id, assistantUpdateRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 此 API 可以创建一个 Assistant 共享 Token,可以将你的 Assistant 公开出去使用。 + * @summary 获取 Assistant 共享列表 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdSharesGet(id: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdSharesGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 此方法将会获取一个 Token,用户将会通过这个 Token 来访问你的 Assistant 并调用工具。 + * @summary 创建 Assistant 共享 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdSharesPost(id: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdSharesPost(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 此方法将会删除共享,删除后,共享将会立即失效。 + * @summary 删除 Assistant 共享 + * @param {number} id + * @param {number} shareId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdSharesShareIdDelete(id: number, shareId: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdSharesShareIdDelete(id, shareId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 获取 Assistant 所绑定的 Tool + * @param {number} id Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdToolsGet(id: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdToolsGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 解绑 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdToolsToolIdDelete(id: number, toolId: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdToolsToolIdDelete(id, toolId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 绑定 Tool + * @param {number} id Assistant ID + * @param {number} toolId Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsIdToolsToolIdPost(id: number, toolId: number, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsIdToolsToolIdPost(id, toolId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 创建 Assistant + * @param {SchemaAssistantCreateRequest} assistant Assistant + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssistantApi + */ + public apiV1AssistantsPost(assistant: SchemaAssistantCreateRequest, options?: RawAxiosRequestConfig) { + return AssistantApiFp(this.configuration).apiV1AssistantsPost(assistant, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * ChatApi - axios parameter creator + * @export + */ +export const ChatApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token + * @summary OpenAI Chat Completion + * @param {SchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiOpenaiCompatibleV1ChatCompletionsPost: async (chat: SchemaOpenAIChatCompletionRequest, 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 + * @param {number} [assistantId] Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsGet: async (assistantId?: number, options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/chats`; + // 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 (assistantId !== undefined) { + localVarQueryParameter['assistant_id'] = assistantId; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * get string by ID + * @summary Delete Chat + * @param {number} id Chat ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdDelete: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ChatsIdDelete', 'id', id) + const localVarPath = `/api/v1/chats/{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, + }; + }, + /** + * get string by ID + * @summary Create Chat + * @param {SchemaChatCreateRequest} chat Chat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsPost: async (chat: SchemaChatCreateRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'chat' is not null or undefined + assertParamExists('apiV1ChatsPost', 'chat', chat) + const localVarPath = `/api/v1/chats`; + // 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(chat, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ChatApi - functional programming interface + * @export + */ +export const ChatApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ChatApiAxiosParamCreator(configuration) + return { + /** + * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token + * @summary OpenAI Chat Completion + * @param {SchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiOpenaiCompatibleV1ChatCompletionsPost(chat: SchemaOpenAIChatCompletionRequest, 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 + * @param {number} [assistantId] Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatsGet(assistantId?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsGet(assistantId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatApi.apiV1ChatsGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * get string by ID + * @summary Delete Chat + * @param {number} id Chat ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatsIdDelete(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsIdDelete(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatApi.apiV1ChatsIdDelete']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * get string by ID + * @summary Create Chat + * @param {SchemaChatCreateRequest} chat Chat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatsPost(chat: SchemaChatCreateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsPost(chat, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatApi.apiV1ChatsPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ChatApi - factory interface + * @export + */ +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 {SchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiOpenaiCompatibleV1ChatCompletionsPost(chat: SchemaOpenAIChatCompletionRequest, xUserIP?: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiOpenaiCompatibleV1ChatCompletionsPost(chat, xUserIP, options).then((request) => request(axios, basePath)); + }, + /** + * get string by ID + * @summary 获取所有 Chat + * @param {number} [assistantId] Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsGet(assistantId?: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatsGet(assistantId, options).then((request) => request(axios, basePath)); + }, + /** + * get string by ID + * @summary Delete Chat + * @param {number} id Chat ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdDelete(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatsIdDelete(id, options).then((request) => request(axios, basePath)); + }, + /** + * get string by ID + * @summary Create Chat + * @param {SchemaChatCreateRequest} chat Chat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsPost(chat: SchemaChatCreateRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatsPost(chat, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ChatApi - object-oriented interface + * @export + * @class ChatApi + * @extends {BaseAPI} + */ +export class ChatApi extends BaseAPI { + /** + * 兼容 OpenAI Chat Completion 接口,认证需要使用 Assistant Share Token + * @summary OpenAI Chat Completion + * @param {SchemaOpenAIChatCompletionRequest} chat Chat + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatApi + */ + public apiOpenaiCompatibleV1ChatCompletionsPost(chat: SchemaOpenAIChatCompletionRequest, 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 + * @param {number} [assistantId] Assistant ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatApi + */ + public apiV1ChatsGet(assistantId?: number, options?: RawAxiosRequestConfig) { + return ChatApiFp(this.configuration).apiV1ChatsGet(assistantId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * get string by ID + * @summary Delete Chat + * @param {number} id Chat ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatApi + */ + public apiV1ChatsIdDelete(id: number, options?: RawAxiosRequestConfig) { + return ChatApiFp(this.configuration).apiV1ChatsIdDelete(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * get string by ID + * @summary Create Chat + * @param {SchemaChatCreateRequest} chat Chat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatApi + */ + public apiV1ChatsPost(chat: SchemaChatCreateRequest, options?: RawAxiosRequestConfig) { + return ChatApiFp(this.configuration).apiV1ChatsPost(chat, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * ChatMessageApi - axios parameter creator + * @export + */ +export const ChatMessageApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * 清空当前聊天记录 + * @summary 清空聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdClearPost: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ChatsIdClearPost', 'id', id) + const localVarPath = `/api/v1/chats/{id}/clear` + .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) + + + + 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 {ApiV1ChatsIdFilesPostRequest} apiV1ChatsIdFilesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdFilesPost: async (id: number, apiV1ChatsIdFilesPostRequest: ApiV1ChatsIdFilesPostRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ChatsIdFilesPost', 'id', id) + // verify required parameter 'apiV1ChatsIdFilesPostRequest' is not null or undefined + assertParamExists('apiV1ChatsIdFilesPost', 'apiV1ChatsIdFilesPostRequest', apiV1ChatsIdFilesPostRequest) + const localVarPath = `/api/v1/chats/{id}/files` + .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(apiV1ChatsIdFilesPostRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * get string by ID + * @summary 查看聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdMessagesGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ChatsIdMessagesGet', 'id', id) + const localVarPath = `/api/v1/chats/{id}/messages` + .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, + }; + }, + /** + * get string by ID + * @summary 添加聊天记录 + * @param {number} id + * @param {SchemaChatMessageAddRequest} message Message + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdMessagesPost: async (id: number, message: SchemaChatMessageAddRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ChatsIdMessagesPost', 'id', id) + // verify required parameter 'message' is not null or undefined + assertParamExists('apiV1ChatsIdMessagesPost', 'message', message) + const localVarPath = `/api/v1/chats/{id}/messages` + .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(message, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * get string by ID + * @summary 流式传输聊天内容 + * @param {string} streamId Chat stream id + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1StreamStreamIdGet: async (streamId: string, xUserIP?: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'streamId' is not null or undefined + assertParamExists('apiV1StreamStreamIdGet', 'streamId', streamId) + const localVarPath = `/api/v1/stream/{stream_id}` + .replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))); + // 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; + + if (xUserIP != null) { + localVarHeaderParameter['X-User-IP'] = String(xUserIP); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ChatMessageApi - functional programming interface + * @export + */ +export const ChatMessageApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ChatMessageApiAxiosParamCreator(configuration) + return { + /** + * 清空当前聊天记录 + * @summary 清空聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatsIdClearPost(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsIdClearPost(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdClearPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 将一个文件添加到聊天记录中 + * @summary 添加文件 + * @param {number} id + * @param {ApiV1ChatsIdFilesPostRequest} apiV1ChatsIdFilesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatsIdFilesPost(id: number, apiV1ChatsIdFilesPostRequest: ApiV1ChatsIdFilesPostRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsIdFilesPost(id, apiV1ChatsIdFilesPostRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdFilesPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * get string by ID + * @summary 查看聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsIdMessagesGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdMessagesGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * get string by ID + * @summary 添加聊天记录 + * @param {number} id + * @param {SchemaChatMessageAddRequest} message Message + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatsIdMessagesPost(id: number, message: SchemaChatMessageAddRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatsIdMessagesPost(id, message, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatMessageApi.apiV1ChatsIdMessagesPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * get string by ID + * @summary 流式传输聊天内容 + * @param {string} streamId Chat stream id + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1StreamStreamIdGet(streamId: string, xUserIP?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1StreamStreamIdGet(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); + }, + } +}; + +/** + * ChatMessageApi - factory interface + * @export + */ +export const ChatMessageApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ChatMessageApiFp(configuration) + return { + /** + * 清空当前聊天记录 + * @summary 清空聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdClearPost(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatsIdClearPost(id, options).then((request) => request(axios, basePath)); + }, + /** + * 将一个文件添加到聊天记录中 + * @summary 添加文件 + * @param {number} id + * @param {ApiV1ChatsIdFilesPostRequest} apiV1ChatsIdFilesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdFilesPost(id: number, apiV1ChatsIdFilesPostRequest: ApiV1ChatsIdFilesPostRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatsIdFilesPost(id, apiV1ChatsIdFilesPostRequest, options).then((request) => request(axios, basePath)); + }, + /** + * get string by ID + * @summary 查看聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatsIdMessagesGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * get string by ID + * @summary 添加聊天记录 + * @param {number} id + * @param {SchemaChatMessageAddRequest} message Message + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatsIdMessagesPost(id: number, message: SchemaChatMessageAddRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatsIdMessagesPost(id, message, options).then((request) => request(axios, basePath)); + }, + /** + * get string by ID + * @summary 流式传输聊天内容 + * @param {string} streamId Chat stream id + * @param {string} [xUserIP] 指定聊天中的用户 IP 地址,不指定则自动获取。此 IP 地址只会增加至 Prompt 中,如果不希望增加,请关闭系统自带 Prompt 选项 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1StreamStreamIdGet(streamId: string, xUserIP?: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1StreamStreamIdGet(streamId, xUserIP, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ChatMessageApi - object-oriented interface + * @export + * @class ChatMessageApi + * @extends {BaseAPI} + */ +export class ChatMessageApi extends BaseAPI { + /** + * 清空当前聊天记录 + * @summary 清空聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatMessageApi + */ + public apiV1ChatsIdClearPost(id: number, options?: RawAxiosRequestConfig) { + return ChatMessageApiFp(this.configuration).apiV1ChatsIdClearPost(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 将一个文件添加到聊天记录中 + * @summary 添加文件 + * @param {number} id + * @param {ApiV1ChatsIdFilesPostRequest} apiV1ChatsIdFilesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatMessageApi + */ + public apiV1ChatsIdFilesPost(id: number, apiV1ChatsIdFilesPostRequest: ApiV1ChatsIdFilesPostRequest, options?: RawAxiosRequestConfig) { + return ChatMessageApiFp(this.configuration).apiV1ChatsIdFilesPost(id, apiV1ChatsIdFilesPostRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * get string by ID + * @summary 查看聊天记录 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatMessageApi + */ + public apiV1ChatsIdMessagesGet(id: number, options?: RawAxiosRequestConfig) { + return ChatMessageApiFp(this.configuration).apiV1ChatsIdMessagesGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * get string by ID + * @summary 添加聊天记录 + * @param {number} id + * @param {SchemaChatMessageAddRequest} message Message + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatMessageApi + */ + public apiV1ChatsIdMessagesPost(id: number, message: SchemaChatMessageAddRequest, options?: RawAxiosRequestConfig) { + return ChatMessageApiFp(this.configuration).apiV1ChatsIdMessagesPost(id, message, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * get string by ID + * @summary 流式传输聊天内容 + * @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(streamId: string, xUserIP?: string, options?: RawAxiosRequestConfig) { + return ChatMessageApiFp(this.configuration).apiV1StreamStreamIdGet(streamId, xUserIP, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * ChatPublicApi - axios parameter creator + * @export + */ +export const ChatPublicApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary 清空公开对话的聊天记录 + * @param {number} chatId + * @param {SchemaGetPublicChatMessageRequest} schemaGetPublicChatMessageRequest GetPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdClearPost: async (chatId: number, schemaGetPublicChatMessageRequest: SchemaGetPublicChatMessageRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'chatId' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdClearPost', 'chatId', chatId) + // verify required parameter 'schemaGetPublicChatMessageRequest' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdClearPost', 'schemaGetPublicChatMessageRequest', schemaGetPublicChatMessageRequest) + const localVarPath = `/api/v1/chat_public/{chat_id}/clear` + .replace(`{${"chat_id"}}`, encodeURIComponent(String(chatId))); + // 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; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(schemaGetPublicChatMessageRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 将一个图片添加到聊天记录中 + * @summary 添加图片 + * @param {number} chatId + * @param {ApiV1ChatPublicChatIdImagesPostRequest} apiV1ChatPublicChatIdImagesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdImagesPost: async (chatId: number, apiV1ChatPublicChatIdImagesPostRequest: ApiV1ChatPublicChatIdImagesPostRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'chatId' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdImagesPost', 'chatId', chatId) + // verify required parameter 'apiV1ChatPublicChatIdImagesPostRequest' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdImagesPost', 'apiV1ChatPublicChatIdImagesPostRequest', apiV1ChatPublicChatIdImagesPostRequest) + const localVarPath = `/api/v1/chat_public/{chat_id}/images` + .replace(`{${"chat_id"}}`, encodeURIComponent(String(chatId))); + // 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; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(apiV1ChatPublicChatIdImagesPostRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 获取公开对话的聊天记录 + * @param {number} chatId + * @param {string} assistantToken + * @param {string} guestId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdMessagesGet: async (chatId: number, assistantToken: string, guestId: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'chatId' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdMessagesGet', 'chatId', chatId) + // verify required parameter 'assistantToken' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdMessagesGet', 'assistantToken', assistantToken) + // verify required parameter 'guestId' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdMessagesGet', 'guestId', guestId) + const localVarPath = `/api/v1/chat_public/{chat_id}/messages` + .replace(`{${"chat_id"}}`, encodeURIComponent(String(chatId))); + // 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; + + if (assistantToken !== undefined) { + localVarQueryParameter['assistant_token'] = assistantToken; + } + + if (guestId !== undefined) { + localVarQueryParameter['guest_id'] = guestId; + } + + + + 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} chatId + * @param {SchemaAddPublicChatMessageRequest} schemaAddPublicChatMessageRequest AddPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdMessagesPost: async (chatId: number, schemaAddPublicChatMessageRequest: SchemaAddPublicChatMessageRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'chatId' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdMessagesPost', 'chatId', chatId) + // verify required parameter 'schemaAddPublicChatMessageRequest' is not null or undefined + assertParamExists('apiV1ChatPublicChatIdMessagesPost', 'schemaAddPublicChatMessageRequest', schemaAddPublicChatMessageRequest) + const localVarPath = `/api/v1/chat_public/{chat_id}/messages` + .replace(`{${"chat_id"}}`, encodeURIComponent(String(chatId))); + // 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; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(schemaAddPublicChatMessageRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 获取公开对话 + * @param {SchemaChatPublicListRequest} schemaChatPublicListRequest ChatPublicListRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicGet: async (schemaChatPublicListRequest: SchemaChatPublicListRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'schemaChatPublicListRequest' is not null or undefined + assertParamExists('apiV1ChatPublicGet', 'schemaChatPublicListRequest', schemaChatPublicListRequest) + const localVarPath = `/api/v1/chat_public`; + // 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; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(schemaChatPublicListRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 通过 API 创建一个公开的对话记录 + * @param {SchemaChatPublicRequest} schemaChatPublicRequest ChatPublicRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicPost: async (schemaChatPublicRequest: SchemaChatPublicRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'schemaChatPublicRequest' is not null or undefined + assertParamExists('apiV1ChatPublicPost', 'schemaChatPublicRequest', schemaChatPublicRequest) + const localVarPath = `/api/v1/chat_public`; + // 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; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(schemaChatPublicRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ChatPublicApi - functional programming interface + * @export + */ +export const ChatPublicApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ChatPublicApiAxiosParamCreator(configuration) + return { + /** + * + * @summary 清空公开对话的聊天记录 + * @param {number} chatId + * @param {SchemaGetPublicChatMessageRequest} schemaGetPublicChatMessageRequest GetPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatPublicChatIdClearPost(chatId: number, schemaGetPublicChatMessageRequest: SchemaGetPublicChatMessageRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatPublicChatIdClearPost(chatId, schemaGetPublicChatMessageRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatPublicApi.apiV1ChatPublicChatIdClearPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 将一个图片添加到聊天记录中 + * @summary 添加图片 + * @param {number} chatId + * @param {ApiV1ChatPublicChatIdImagesPostRequest} apiV1ChatPublicChatIdImagesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatPublicChatIdImagesPost(chatId: number, apiV1ChatPublicChatIdImagesPostRequest: ApiV1ChatPublicChatIdImagesPostRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatPublicChatIdImagesPost(chatId, apiV1ChatPublicChatIdImagesPostRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatPublicApi.apiV1ChatPublicChatIdImagesPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 获取公开对话的聊天记录 + * @param {number} chatId + * @param {string} assistantToken + * @param {string} guestId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatPublicChatIdMessagesGet(chatId: number, assistantToken: string, guestId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatPublicChatIdMessagesGet(chatId, assistantToken, guestId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatPublicApi.apiV1ChatPublicChatIdMessagesGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 增加公开对话的聊天记录 + * @param {number} chatId + * @param {SchemaAddPublicChatMessageRequest} schemaAddPublicChatMessageRequest AddPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatPublicChatIdMessagesPost(chatId: number, schemaAddPublicChatMessageRequest: SchemaAddPublicChatMessageRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatPublicChatIdMessagesPost(chatId, schemaAddPublicChatMessageRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatPublicApi.apiV1ChatPublicChatIdMessagesPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 获取公开对话 + * @param {SchemaChatPublicListRequest} schemaChatPublicListRequest ChatPublicListRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatPublicGet(schemaChatPublicListRequest: SchemaChatPublicListRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatPublicGet(schemaChatPublicListRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatPublicApi.apiV1ChatPublicGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 通过 API 创建一个公开的对话记录 + * @param {SchemaChatPublicRequest} schemaChatPublicRequest ChatPublicRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ChatPublicPost(schemaChatPublicRequest: SchemaChatPublicRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ChatPublicPost(schemaChatPublicRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ChatPublicApi.apiV1ChatPublicPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ChatPublicApi - factory interface + * @export + */ +export const ChatPublicApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ChatPublicApiFp(configuration) + return { + /** + * + * @summary 清空公开对话的聊天记录 + * @param {number} chatId + * @param {SchemaGetPublicChatMessageRequest} schemaGetPublicChatMessageRequest GetPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdClearPost(chatId: number, schemaGetPublicChatMessageRequest: SchemaGetPublicChatMessageRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatPublicChatIdClearPost(chatId, schemaGetPublicChatMessageRequest, options).then((request) => request(axios, basePath)); + }, + /** + * 将一个图片添加到聊天记录中 + * @summary 添加图片 + * @param {number} chatId + * @param {ApiV1ChatPublicChatIdImagesPostRequest} apiV1ChatPublicChatIdImagesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdImagesPost(chatId: number, apiV1ChatPublicChatIdImagesPostRequest: ApiV1ChatPublicChatIdImagesPostRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatPublicChatIdImagesPost(chatId, apiV1ChatPublicChatIdImagesPostRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 获取公开对话的聊天记录 + * @param {number} chatId + * @param {string} assistantToken + * @param {string} guestId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdMessagesGet(chatId: number, assistantToken: string, guestId: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatPublicChatIdMessagesGet(chatId, assistantToken, guestId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 增加公开对话的聊天记录 + * @param {number} chatId + * @param {SchemaAddPublicChatMessageRequest} schemaAddPublicChatMessageRequest AddPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicChatIdMessagesPost(chatId: number, schemaAddPublicChatMessageRequest: SchemaAddPublicChatMessageRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatPublicChatIdMessagesPost(chatId, schemaAddPublicChatMessageRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 获取公开对话 + * @param {SchemaChatPublicListRequest} schemaChatPublicListRequest ChatPublicListRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicGet(schemaChatPublicListRequest: SchemaChatPublicListRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatPublicGet(schemaChatPublicListRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 通过 API 创建一个公开的对话记录 + * @param {SchemaChatPublicRequest} schemaChatPublicRequest ChatPublicRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ChatPublicPost(schemaChatPublicRequest: SchemaChatPublicRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ChatPublicPost(schemaChatPublicRequest, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ChatPublicApi - object-oriented interface + * @export + * @class ChatPublicApi + * @extends {BaseAPI} + */ +export class ChatPublicApi extends BaseAPI { + /** + * + * @summary 清空公开对话的聊天记录 + * @param {number} chatId + * @param {SchemaGetPublicChatMessageRequest} schemaGetPublicChatMessageRequest GetPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatPublicApi + */ + public apiV1ChatPublicChatIdClearPost(chatId: number, schemaGetPublicChatMessageRequest: SchemaGetPublicChatMessageRequest, options?: RawAxiosRequestConfig) { + return ChatPublicApiFp(this.configuration).apiV1ChatPublicChatIdClearPost(chatId, schemaGetPublicChatMessageRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 将一个图片添加到聊天记录中 + * @summary 添加图片 + * @param {number} chatId + * @param {ApiV1ChatPublicChatIdImagesPostRequest} apiV1ChatPublicChatIdImagesPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatPublicApi + */ + public apiV1ChatPublicChatIdImagesPost(chatId: number, apiV1ChatPublicChatIdImagesPostRequest: ApiV1ChatPublicChatIdImagesPostRequest, options?: RawAxiosRequestConfig) { + return ChatPublicApiFp(this.configuration).apiV1ChatPublicChatIdImagesPost(chatId, apiV1ChatPublicChatIdImagesPostRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 获取公开对话的聊天记录 + * @param {number} chatId + * @param {string} assistantToken + * @param {string} guestId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatPublicApi + */ + public apiV1ChatPublicChatIdMessagesGet(chatId: number, assistantToken: string, guestId: string, options?: RawAxiosRequestConfig) { + return ChatPublicApiFp(this.configuration).apiV1ChatPublicChatIdMessagesGet(chatId, assistantToken, guestId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 增加公开对话的聊天记录 + * @param {number} chatId + * @param {SchemaAddPublicChatMessageRequest} schemaAddPublicChatMessageRequest AddPublicChatMessageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatPublicApi + */ + public apiV1ChatPublicChatIdMessagesPost(chatId: number, schemaAddPublicChatMessageRequest: SchemaAddPublicChatMessageRequest, options?: RawAxiosRequestConfig) { + return ChatPublicApiFp(this.configuration).apiV1ChatPublicChatIdMessagesPost(chatId, schemaAddPublicChatMessageRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 获取公开对话 + * @param {SchemaChatPublicListRequest} schemaChatPublicListRequest ChatPublicListRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatPublicApi + */ + public apiV1ChatPublicGet(schemaChatPublicListRequest: SchemaChatPublicListRequest, options?: RawAxiosRequestConfig) { + return ChatPublicApiFp(this.configuration).apiV1ChatPublicGet(schemaChatPublicListRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 通过 API 创建一个公开的对话记录 + * @param {SchemaChatPublicRequest} schemaChatPublicRequest ChatPublicRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ChatPublicApi + */ + public apiV1ChatPublicPost(schemaChatPublicRequest: SchemaChatPublicRequest, options?: RawAxiosRequestConfig) { + return ChatPublicApiFp(this.configuration).apiV1ChatPublicPost(schemaChatPublicRequest, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * FileApi - axios parameter creator + * @export + */ +export const FileApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载公开文件 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1FilesIdDownloadGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1FilesIdDownloadGet', 'id', id) + const localVarPath = `/api/v1/files/{id}/download` + .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; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载用户开文件 + * @param {number} id + * @param {string} [idToken] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1FilesUserIdDownloadGet: async (id: number, idToken?: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1FilesUserIdDownloadGet', 'id', id) + const localVarPath = `/api/v1/files/user/{id}/download` + .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; + + if (idToken !== undefined) { + localVarQueryParameter['id_token'] = idToken; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * FileApi - functional programming interface + * @export + */ +export const FileApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = FileApiAxiosParamCreator(configuration) + return { + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载公开文件 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1FilesIdDownloadGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1FilesIdDownloadGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['FileApi.apiV1FilesIdDownloadGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载用户开文件 + * @param {number} id + * @param {string} [idToken] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1FilesUserIdDownloadGet(id: number, idToken?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1FilesUserIdDownloadGet(id, idToken, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['FileApi.apiV1FilesUserIdDownloadGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * FileApi - factory interface + * @export + */ +export const FileApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = FileApiFp(configuration) + return { + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载公开文件 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1FilesIdDownloadGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1FilesIdDownloadGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载用户开文件 + * @param {number} id + * @param {string} [idToken] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1FilesUserIdDownloadGet(id: number, idToken?: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1FilesUserIdDownloadGet(id, idToken, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * FileApi - object-oriented interface + * @export + * @class FileApi + * @extends {BaseAPI} + */ +export class FileApi extends BaseAPI { + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载公开文件 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FileApi + */ + public apiV1FilesIdDownloadGet(id: number, options?: RawAxiosRequestConfig) { + return FileApiFp(this.configuration).apiV1FilesIdDownloadGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 根据 File ID 下载文件。如果文件是私有的,将无法下载 + * @summary 下载用户开文件 + * @param {number} id + * @param {string} [idToken] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FileApi + */ + public apiV1FilesUserIdDownloadGet(id: number, idToken?: string, options?: RawAxiosRequestConfig) { + return FileApiFp(this.configuration).apiV1FilesUserIdDownloadGet(id, idToken, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * LibrariesApi - axios parameter creator + * @export + */ +export const LibrariesApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary 获取所有的资料库 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesGet: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/libraries`; + // 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} + */ + apiV1LibrariesIdDelete: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1LibrariesIdDelete', 'id', id) + const localVarPath = `/api/v1/libraries/{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 {number} documentId + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdDocumentsDocumentIdDelete: async (documentId: number, id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'documentId' is not null or undefined + assertParamExists('apiV1LibrariesIdDocumentsDocumentIdDelete', 'documentId', documentId) + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1LibrariesIdDocumentsDocumentIdDelete', 'id', id) + const localVarPath = `/api/v1/libraries/{id}/documents/{document_id}` + .replace(`{${"document_id"}}`, encodeURIComponent(String(documentId))) + .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 {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdDocumentsGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1LibrariesIdDocumentsGet', 'id', id) + const localVarPath = `/api/v1/libraries/{id}/documents` + .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 获取一个资料库 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1LibrariesIdGet', 'id', id) + const localVarPath = `/api/v1/libraries/{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: '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 {SchemaLibraryUpdateRequest} schemaLibraryUpdateRequest schema.LibraryUpdateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdPatch: async (id: number, schemaLibraryUpdateRequest: SchemaLibraryUpdateRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1LibrariesIdPatch', 'id', id) + // verify required parameter 'schemaLibraryUpdateRequest' is not null or undefined + assertParamExists('apiV1LibrariesIdPatch', 'schemaLibraryUpdateRequest', schemaLibraryUpdateRequest) + const localVarPath = `/api/v1/libraries/{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(schemaLibraryUpdateRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 创建一个资料库 + * @param {SchemaLibraryCreateRequest} schemaLibraryCreateRequest schema.LibraryCreateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesPost: async (schemaLibraryCreateRequest: SchemaLibraryCreateRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'schemaLibraryCreateRequest' is not null or undefined + assertParamExists('apiV1LibrariesPost', 'schemaLibraryCreateRequest', schemaLibraryCreateRequest) + const localVarPath = `/api/v1/libraries`; + // 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(schemaLibraryCreateRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * LibrariesApi - functional programming interface + * @export + */ +export const LibrariesApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = LibrariesApiAxiosParamCreator(configuration) + return { + /** + * + * @summary 获取所有的资料库 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1LibrariesGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1LibrariesGet(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LibrariesApi.apiV1LibrariesGet']?.[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 apiV1LibrariesIdDelete(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1LibrariesIdDelete(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LibrariesApi.apiV1LibrariesIdDelete']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 删除指定的文档 + * @param {number} documentId + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1LibrariesIdDocumentsDocumentIdDelete(documentId: number, id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1LibrariesIdDocumentsDocumentIdDelete(documentId, id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LibrariesApi.apiV1LibrariesIdDocumentsDocumentIdDelete']?.[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 apiV1LibrariesIdDocumentsGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1LibrariesIdDocumentsGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LibrariesApi.apiV1LibrariesIdDocumentsGet']?.[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 apiV1LibrariesIdGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1LibrariesIdGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LibrariesApi.apiV1LibrariesIdGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 更新资料库 + * @param {number} id + * @param {SchemaLibraryUpdateRequest} schemaLibraryUpdateRequest schema.LibraryUpdateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1LibrariesIdPatch(id: number, schemaLibraryUpdateRequest: SchemaLibraryUpdateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1LibrariesIdPatch(id, schemaLibraryUpdateRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LibrariesApi.apiV1LibrariesIdPatch']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 创建一个资料库 + * @param {SchemaLibraryCreateRequest} schemaLibraryCreateRequest schema.LibraryCreateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1LibrariesPost(schemaLibraryCreateRequest: SchemaLibraryCreateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1LibrariesPost(schemaLibraryCreateRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LibrariesApi.apiV1LibrariesPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * LibrariesApi - factory interface + * @export + */ +export const LibrariesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = LibrariesApiFp(configuration) + return { + /** + * + * @summary 获取所有的资料库 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesGet(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1LibrariesGet(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 删除资料库 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdDelete(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1LibrariesIdDelete(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 删除指定的文档 + * @param {number} documentId + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdDocumentsDocumentIdDelete(documentId: number, id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1LibrariesIdDocumentsDocumentIdDelete(documentId, id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 列出资料库以及资料库下的文档 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdDocumentsGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1LibrariesIdDocumentsGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 获取一个资料库 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1LibrariesIdGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 更新资料库 + * @param {number} id + * @param {SchemaLibraryUpdateRequest} schemaLibraryUpdateRequest schema.LibraryUpdateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesIdPatch(id: number, schemaLibraryUpdateRequest: SchemaLibraryUpdateRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1LibrariesIdPatch(id, schemaLibraryUpdateRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 创建一个资料库 + * @param {SchemaLibraryCreateRequest} schemaLibraryCreateRequest schema.LibraryCreateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1LibrariesPost(schemaLibraryCreateRequest: SchemaLibraryCreateRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1LibrariesPost(schemaLibraryCreateRequest, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * LibrariesApi - object-oriented interface + * @export + * @class LibrariesApi + * @extends {BaseAPI} + */ +export class LibrariesApi extends BaseAPI { + /** + * + * @summary 获取所有的资料库 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LibrariesApi + */ + public apiV1LibrariesGet(options?: RawAxiosRequestConfig) { + return LibrariesApiFp(this.configuration).apiV1LibrariesGet(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 删除资料库 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LibrariesApi + */ + public apiV1LibrariesIdDelete(id: number, options?: RawAxiosRequestConfig) { + return LibrariesApiFp(this.configuration).apiV1LibrariesIdDelete(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 删除指定的文档 + * @param {number} documentId + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LibrariesApi + */ + public apiV1LibrariesIdDocumentsDocumentIdDelete(documentId: number, id: number, options?: RawAxiosRequestConfig) { + return LibrariesApiFp(this.configuration).apiV1LibrariesIdDocumentsDocumentIdDelete(documentId, id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 列出资料库以及资料库下的文档 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LibrariesApi + */ + public apiV1LibrariesIdDocumentsGet(id: number, options?: RawAxiosRequestConfig) { + return LibrariesApiFp(this.configuration).apiV1LibrariesIdDocumentsGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 获取一个资料库 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LibrariesApi + */ + public apiV1LibrariesIdGet(id: number, options?: RawAxiosRequestConfig) { + return LibrariesApiFp(this.configuration).apiV1LibrariesIdGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 更新资料库 + * @param {number} id + * @param {SchemaLibraryUpdateRequest} schemaLibraryUpdateRequest schema.LibraryUpdateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LibrariesApi + */ + public apiV1LibrariesIdPatch(id: number, schemaLibraryUpdateRequest: SchemaLibraryUpdateRequest, options?: RawAxiosRequestConfig) { + return LibrariesApiFp(this.configuration).apiV1LibrariesIdPatch(id, schemaLibraryUpdateRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 创建一个资料库 + * @param {SchemaLibraryCreateRequest} schemaLibraryCreateRequest schema.LibraryCreateRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LibrariesApi + */ + public apiV1LibrariesPost(schemaLibraryCreateRequest: SchemaLibraryCreateRequest, options?: RawAxiosRequestConfig) { + return LibrariesApiFp(this.configuration).apiV1LibrariesPost(schemaLibraryCreateRequest, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * 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 => { + 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 => { + // 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 => { + 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> { + 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> { + 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> { + 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?: RawAxiosRequestConfig): AxiosPromise { + 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?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1MemoriesIdDelete(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 删除全部记忆 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1MemoriesPurgePost(options?: RawAxiosRequestConfig): AxiosPromise { + 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 + */ +export const PingApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * get string by ID + * @summary Greet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1PingGet: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/ping`; + // 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, + }; + }, + } +}; + +/** + * PingApi - functional programming interface + * @export + */ +export const PingApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PingApiAxiosParamCreator(configuration) + return { + /** + * get string by ID + * @summary Greet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1PingGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1PingGet(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['PingApi.apiV1PingGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * PingApi - factory interface + * @export + */ +export const PingApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PingApiFp(configuration) + return { + /** + * get string by ID + * @summary Greet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1PingGet(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1PingGet(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * PingApi - object-oriented interface + * @export + * @class PingApi + * @extends {BaseAPI} + */ +export class PingApi extends BaseAPI { + /** + * get string by ID + * @summary Greet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PingApi + */ + public apiV1PingGet(options?: RawAxiosRequestConfig) { + return PingApiFp(this.configuration).apiV1PingGet(options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * ToolApi - axios parameter creator + * @export + */ +export const ToolApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * List tools + * @summary List Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsGet: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/tools`; + // 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, + }; + }, + /** + * DeleteTool + * @summary DeleteTool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsIdDelete: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ToolsIdDelete', 'id', id) + const localVarPath = `/api/v1/tools/{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, + }; + }, + /** + * Get tool + * @summary Get Tool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsIdGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ToolsIdGet', 'id', id) + const localVarPath = `/api/v1/tools/{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: '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, + }; + }, + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 更新 Tool 的数据 + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsIdUpdatePost: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiV1ToolsIdUpdatePost', 'id', id) + const localVarPath = `/api/v1/tools/{id}/update` + .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) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Create tool + * @summary Create Tool + * @param {SchemaToolCreateRequest} tool Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsPost: async (tool: SchemaToolCreateRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'tool' is not null or undefined + assertParamExists('apiV1ToolsPost', 'tool', tool) + const localVarPath = `/api/v1/tools`; + // 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(tool, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 校验 Discovery 语法 + * @param {SchemaToolDiscoveryInput} toolDiscoveryInput ToolDiscoveryInput + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsSyntaxPost: async (toolDiscoveryInput: SchemaToolDiscoveryInput, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'toolDiscoveryInput' is not null or undefined + assertParamExists('apiV1ToolsSyntaxPost', 'toolDiscoveryInput', toolDiscoveryInput) + const localVarPath = `/api/v1/tools/syntax`; + // 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(toolDiscoveryInput, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ToolApi - functional programming interface + * @export + */ +export const ToolApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ToolApiAxiosParamCreator(configuration) + return { + /** + * List tools + * @summary List Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ToolsGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ToolsGet(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ToolApi.apiV1ToolsGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * DeleteTool + * @summary DeleteTool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ToolsIdDelete(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ToolsIdDelete(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ToolApi.apiV1ToolsIdDelete']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Get tool + * @summary Get Tool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ToolsIdGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ToolsIdGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ToolApi.apiV1ToolsIdGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 更新 Tool 的数据 + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ToolsIdUpdatePost(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ToolsIdUpdatePost(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ToolApi.apiV1ToolsIdUpdatePost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Create tool + * @summary Create Tool + * @param {SchemaToolCreateRequest} tool Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ToolsPost(tool: SchemaToolCreateRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ToolsPost(tool, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ToolApi.apiV1ToolsPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 校验 Discovery 语法 + * @param {SchemaToolDiscoveryInput} toolDiscoveryInput ToolDiscoveryInput + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV1ToolsSyntaxPost(toolDiscoveryInput: SchemaToolDiscoveryInput, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1ToolsSyntaxPost(toolDiscoveryInput, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ToolApi.apiV1ToolsSyntaxPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ToolApi - factory interface + * @export + */ +export const ToolApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ToolApiFp(configuration) + return { + /** + * List tools + * @summary List Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsGet(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ToolsGet(options).then((request) => request(axios, basePath)); + }, + /** + * DeleteTool + * @summary DeleteTool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsIdDelete(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ToolsIdDelete(id, options).then((request) => request(axios, basePath)); + }, + /** + * Get tool + * @summary Get Tool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsIdGet(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ToolsIdGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 更新 Tool 的数据 + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsIdUpdatePost(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ToolsIdUpdatePost(id, options).then((request) => request(axios, basePath)); + }, + /** + * Create tool + * @summary Create Tool + * @param {SchemaToolCreateRequest} tool Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsPost(tool: SchemaToolCreateRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ToolsPost(tool, options).then((request) => request(axios, basePath)); + }, + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 校验 Discovery 语法 + * @param {SchemaToolDiscoveryInput} toolDiscoveryInput ToolDiscoveryInput + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV1ToolsSyntaxPost(toolDiscoveryInput: SchemaToolDiscoveryInput, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.apiV1ToolsSyntaxPost(toolDiscoveryInput, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ToolApi - object-oriented interface + * @export + * @class ToolApi + * @extends {BaseAPI} + */ +export class ToolApi extends BaseAPI { + /** + * List tools + * @summary List Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ToolApi + */ + public apiV1ToolsGet(options?: RawAxiosRequestConfig) { + return ToolApiFp(this.configuration).apiV1ToolsGet(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * DeleteTool + * @summary DeleteTool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ToolApi + */ + public apiV1ToolsIdDelete(id: number, options?: RawAxiosRequestConfig) { + return ToolApiFp(this.configuration).apiV1ToolsIdDelete(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Get tool + * @summary Get Tool + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ToolApi + */ + public apiV1ToolsIdGet(id: number, options?: RawAxiosRequestConfig) { + return ToolApiFp(this.configuration).apiV1ToolsIdGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 更新 Tool 的数据 + * @param {number} id Tool ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ToolApi + */ + public apiV1ToolsIdUpdatePost(id: number, options?: RawAxiosRequestConfig) { + return ToolApiFp(this.configuration).apiV1ToolsIdUpdatePost(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Create tool + * @summary Create Tool + * @param {SchemaToolCreateRequest} tool Tool + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ToolApi + */ + public apiV1ToolsPost(tool: SchemaToolCreateRequest, options?: RawAxiosRequestConfig) { + return ToolApiFp(this.configuration).apiV1ToolsPost(tool, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 如果你的 Tool Discovery 内容改变了,你需要调用此接口更新数据 + * @summary 校验 Discovery 语法 + * @param {SchemaToolDiscoveryInput} toolDiscoveryInput ToolDiscoveryInput + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ToolApi + */ + public apiV1ToolsSyntaxPost(toolDiscoveryInput: SchemaToolDiscoveryInput, options?: RawAxiosRequestConfig) { + return ToolApiFp(this.configuration).apiV1ToolsSyntaxPost(toolDiscoveryInput, options).then((request) => request(this.axios, this.basePath)); + } +} + + + diff --git a/src/api/base.ts b/src/api/base.ts new file mode 100644 index 0000000..492934a --- /dev/null +++ b/src/api/base.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Leaflow Amber + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: RawAxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath ?? basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} + +interface ServerMap { + [key: string]: { + url: string, + description: string, + }[]; +} + +/** + * + * @export + */ +export const operationServerMap: ServerMap = { +} diff --git a/src/api/common.ts b/src/api/common.ts new file mode 100644 index 0000000..c3f1cd7 --- /dev/null +++ b/src/api/common.ts @@ -0,0 +1,150 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Leaflow Amber + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/src/api/configuration.ts b/src/api/configuration.ts new file mode 100644 index 0000000..85860d9 --- /dev/null +++ b/src/api/configuration.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Leaflow Amber + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + serverIndex?: number; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.serverIndex = param.serverIndex; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/src/api/git_push.sh b/src/api/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/src/api/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..e1dbc5c --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Leaflow Amber + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/src/assets/fonts/OFL.txt b/src/assets/fonts/OFL.txt new file mode 100644 index 0000000..9cac04c --- /dev/null +++ b/src/assets/fonts/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com), + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/src/assets/fonts/nunito-v16-latin-regular.woff2 b/src/assets/fonts/nunito-v16-latin-regular.woff2 new file mode 100644 index 0000000..2f9cc59 Binary files /dev/null and b/src/assets/fonts/nunito-v16-latin-regular.woff2 differ diff --git a/src/assets/images/logo-universal.png b/src/assets/images/logo-universal.png new file mode 100644 index 0000000..d63303b Binary files /dev/null and b/src/assets/images/logo-universal.png differ diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts new file mode 100644 index 0000000..9a83ee2 --- /dev/null +++ b/src/auto-imports.d.ts @@ -0,0 +1,129 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const EffectScope: typeof import('vue')['EffectScope'] + const computed: typeof import('vue')['computed'] + const createApp: typeof import('vue')['createApp'] + const customRef: typeof import('vue')['customRef'] + const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] + const defineComponent: typeof import('vue')['defineComponent'] + const effectScope: typeof import('vue')['effectScope'] + const getCurrentInstance: typeof import('vue')['getCurrentInstance'] + const getCurrentScope: typeof import('vue')['getCurrentScope'] + const h: typeof import('vue')['h'] + const inject: typeof import('vue')['inject'] + const isProxy: typeof import('vue')['isProxy'] + const isReactive: typeof import('vue')['isReactive'] + const isReadonly: typeof import('vue')['isReadonly'] + const isRef: typeof import('vue')['isRef'] + const markRaw: typeof import('vue')['markRaw'] + const nextTick: typeof import('vue')['nextTick'] + const onActivated: typeof import('vue')['onActivated'] + const onBeforeMount: typeof import('vue')['onBeforeMount'] + const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] + const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] + const onDeactivated: typeof import('vue')['onDeactivated'] + const onErrorCaptured: typeof import('vue')['onErrorCaptured'] + const onMounted: typeof import('vue')['onMounted'] + const onRenderTracked: typeof import('vue')['onRenderTracked'] + const onRenderTriggered: typeof import('vue')['onRenderTriggered'] + const onScopeDispose: typeof import('vue')['onScopeDispose'] + const onServerPrefetch: typeof import('vue')['onServerPrefetch'] + const onUnmounted: typeof import('vue')['onUnmounted'] + const onUpdated: typeof import('vue')['onUpdated'] + const provide: typeof import('vue')['provide'] + const reactive: typeof import('vue')['reactive'] + const readonly: typeof import('vue')['readonly'] + const ref: typeof import('vue')['ref'] + const resolveComponent: typeof import('vue')['resolveComponent'] + const shallowReactive: typeof import('vue')['shallowReactive'] + const shallowReadonly: typeof import('vue')['shallowReadonly'] + const shallowRef: typeof import('vue')['shallowRef'] + const toRaw: typeof import('vue')['toRaw'] + const toRef: typeof import('vue')['toRef'] + const toRefs: typeof import('vue')['toRefs'] + const toValue: typeof import('vue')['toValue'] + const triggerRef: typeof import('vue')['triggerRef'] + const unref: typeof import('vue')['unref'] + const useAttrs: typeof import('vue')['useAttrs'] + const useCssModule: typeof import('vue')['useCssModule'] + const useCssVars: typeof import('vue')['useCssVars'] + const useRoute: typeof import('vue-router/auto')['useRoute'] + const useRouter: typeof import('vue-router/auto')['useRouter'] + const useSlots: typeof import('vue')['useSlots'] + const watch: typeof import('vue')['watch'] + const watchEffect: typeof import('vue')['watchEffect'] + const watchPostEffect: typeof import('vue')['watchPostEffect'] + const watchSyncEffect: typeof import('vue')['watchSyncEffect'] +} +// for type re-export +declare global { + // @ts-ignore + export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' + import('vue') +} +// for vue template auto import +import { UnwrapRef } from 'vue' +declare module 'vue' { + interface GlobalComponents {} + interface ComponentCustomProperties { + readonly EffectScope: UnwrapRef + readonly computed: UnwrapRef + readonly createApp: UnwrapRef + readonly customRef: UnwrapRef + readonly defineAsyncComponent: UnwrapRef + readonly defineComponent: UnwrapRef + readonly effectScope: UnwrapRef + readonly getCurrentInstance: UnwrapRef + readonly getCurrentScope: UnwrapRef + readonly h: UnwrapRef + readonly inject: UnwrapRef + readonly isProxy: UnwrapRef + readonly isReactive: UnwrapRef + readonly isReadonly: UnwrapRef + readonly isRef: UnwrapRef + readonly markRaw: UnwrapRef + readonly nextTick: UnwrapRef + readonly onActivated: UnwrapRef + readonly onBeforeMount: UnwrapRef + readonly onBeforeUnmount: UnwrapRef + readonly onBeforeUpdate: UnwrapRef + readonly onDeactivated: UnwrapRef + readonly onErrorCaptured: UnwrapRef + readonly onMounted: UnwrapRef + readonly onRenderTracked: UnwrapRef + readonly onRenderTriggered: UnwrapRef + readonly onScopeDispose: UnwrapRef + readonly onServerPrefetch: UnwrapRef + readonly onUnmounted: UnwrapRef + readonly onUpdated: UnwrapRef + readonly provide: UnwrapRef + readonly reactive: UnwrapRef + readonly readonly: UnwrapRef + readonly ref: UnwrapRef + readonly resolveComponent: UnwrapRef + readonly shallowReactive: UnwrapRef + readonly shallowReadonly: UnwrapRef + readonly shallowRef: UnwrapRef + readonly toRaw: UnwrapRef + readonly toRef: UnwrapRef + readonly toRefs: UnwrapRef + readonly toValue: UnwrapRef + readonly triggerRef: UnwrapRef + readonly unref: UnwrapRef + readonly useAttrs: UnwrapRef + readonly useCssModule: UnwrapRef + readonly useCssVars: UnwrapRef + readonly useRoute: UnwrapRef + readonly useRouter: UnwrapRef + readonly useSlots: UnwrapRef + readonly watch: UnwrapRef + readonly watchEffect: UnwrapRef + readonly watchPostEffect: UnwrapRef + readonly watchSyncEffect: UnwrapRef + } +} diff --git a/src/components.d.ts b/src/components.d.ts new file mode 100644 index 0000000..4ef5fe8 --- /dev/null +++ b/src/components.d.ts @@ -0,0 +1,15 @@ +/* eslint-disable */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +/* prettier-ignore */ +declare module 'vue' { + export interface GlobalComponents { + Container: typeof import('./components/Container.vue')['default'] + Menu: typeof import('./components/Menu.vue')['default'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] + } +} diff --git a/src/components/Container.vue b/src/components/Container.vue new file mode 100644 index 0000000..7ff5958 --- /dev/null +++ b/src/components/Container.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/src/components/Menu.vue b/src/components/Menu.vue new file mode 100644 index 0000000..ff874ec --- /dev/null +++ b/src/components/Menu.vue @@ -0,0 +1,57 @@ + + + diff --git a/src/config/config.ts b/src/config/config.ts new file mode 100644 index 0000000..1c42bff --- /dev/null +++ b/src/config/config.ts @@ -0,0 +1,25 @@ +const config = { + app_name: "Amber", + oauth_discovery_url: + "https://auth.leaflow.cn/.well-known/openid-configuration", + oauth_client_id: "90020", + oauth_callback_url: "amber-desktop://auth_callback", + oauth_storage_key: "code_verifier", + oauth_scope: "openid profile", + backend: "http://localhost:8080", +}; + +// @ts-ignore ... +if (process.env.NODE_ENV === "production") { + config.backend = "https://amber-api.leaflow.cn"; + config.oauth_callback_url = "https://amber.leaflow.cn/auth/callback"; + config.oauth_client_id = "16"; +} + +config.backend = "https://amber-api.leaflow.cn"; + +// config.backend = "https://amber-api.leaflow.cn"; + +// console.log("api endpoint: " + config.backend); + +export default config; diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..aafef95 --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,8 @@ +/// + +declare module '*.vue' { + import type { DefineComponent } from 'vue' + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types + const component: DefineComponent<{}, {}, any> + export default component +} diff --git a/src/layouts/DefaultLayout.vue b/src/layouts/DefaultLayout.vue new file mode 100644 index 0000000..fb5efea --- /dev/null +++ b/src/layouts/DefaultLayout.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/layouts/Header.vue b/src/layouts/Header.vue new file mode 100644 index 0000000..9c5ac64 --- /dev/null +++ b/src/layouts/Header.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..b037554 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,32 @@ +const meta = document.createElement("meta"); +meta.name = "naive-ui-style"; +document.head.appendChild(meta); + + +import "./style.css"; + +import { createApp } from "vue"; +import { createPinia } from "pinia"; +import piniaPluginPersistedstate from "pinia-plugin-persistedstate"; +import naive from "naive-ui"; +// 通用字体 +import "vfonts/Lato.css"; +// 等宽字体 +import "vfonts/FiraCode.css"; + + +import App from "./App.vue"; +import router from "./plugins/router"; + + + +const pinia = createPinia(); +pinia.use(piniaPluginPersistedstate); + +const app = createApp(App); + +app.use(pinia); +app.use(naive); +app.use(router); + +app.mount("#app"); diff --git a/src/pages/auth/callback.vue b/src/pages/auth/callback.vue new file mode 100644 index 0000000..b206ca2 --- /dev/null +++ b/src/pages/auth/callback.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/pages/auth/continue.vue b/src/pages/auth/continue.vue new file mode 100644 index 0000000..8906212 --- /dev/null +++ b/src/pages/auth/continue.vue @@ -0,0 +1,5 @@ + diff --git a/src/pages/auth/login.vue b/src/pages/auth/login.vue new file mode 100644 index 0000000..6dc04f2 --- /dev/null +++ b/src/pages/auth/login.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/pages/guest/index.vue b/src/pages/guest/index.vue new file mode 100644 index 0000000..e520110 --- /dev/null +++ b/src/pages/guest/index.vue @@ -0,0 +1,24 @@ + + + diff --git a/src/pages/index.vue b/src/pages/index.vue new file mode 100644 index 0000000..179f9b9 --- /dev/null +++ b/src/pages/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/plugins/api.ts b/src/plugins/api.ts new file mode 100644 index 0000000..1b6b290 --- /dev/null +++ b/src/plugins/api.ts @@ -0,0 +1,36 @@ +// import { +// AssistantApi, +// ChatApi, +// ChatMessageApi, +// ChatPublicApi, +// Configuration, +// PingApi, +// ToolApi, +// } from "@/api"; +// import config from "@/config/config"; +// import { useUserStore } from "@/stores/user"; +// +// const userStore = useUserStore(); +// +// const conf = new Configuration(); +// +// conf.basePath = config.backend; +// conf.apiKey = () => { +// return "Bearer " + userStore.id_token; +// }; + +// userStore.$subscribe((mutation, state) => { +// console.log(mutation); +// conf.apiKey = "Bearer " + state.id_token; +// }); + +// const api = { +// Chat: new ChatApi(conf), +// Assistant: new AssistantApi(conf), +// Ping: new PingApi(conf), +// Tool: new ToolApi(conf), +// ChatMessage: new ChatMessageApi(conf), +// ChatPublic: new ChatPublicApi(conf), +// }; +// +// export { api, conf }; diff --git a/src/plugins/axios.ts b/src/plugins/axios.ts new file mode 100644 index 0000000..5bbc8db --- /dev/null +++ b/src/plugins/axios.ts @@ -0,0 +1,5 @@ +import axios from 'axios' + +// axios.defaults.adapter = window.axiosHttpAdapter + +export default axios diff --git a/src/plugins/router.ts b/src/plugins/router.ts new file mode 100644 index 0000000..25ccf72 --- /dev/null +++ b/src/plugins/router.ts @@ -0,0 +1,10 @@ +import { createRouter, createWebHashHistory } from 'vue-router' +import { routes } from 'vue-router/auto-routes' +import { setupLayouts } from 'virtual:generated-layouts' + +const router = createRouter({ + history: createWebHashHistory(), + routes: setupLayouts(routes) +}) + +export default router diff --git a/src/stores/app.ts b/src/stores/app.ts new file mode 100644 index 0000000..c128933 --- /dev/null +++ b/src/stores/app.ts @@ -0,0 +1,31 @@ +// Utilities +import { defineStore } from "pinia"; + +export const useAppStore = defineStore("app", { + persist: false, + state: () => ({ + navigation_drawer: false, + navigation_items: [ + { + icon: "mdi-home", + text: "主页", + to: "/", + }, + { + icon: "mdi-assistant", + text: "助理", + to: "/assistants", + }, + { + icon: "mdi-tools", + text: "工具", + to: "/tools", + }, + { + icon: "mdi-key", + text: "令牌", + to: "/tokens", + }, + ], + }), +}); diff --git a/src/stores/user.ts b/src/stores/user.ts new file mode 100644 index 0000000..43f84f3 --- /dev/null +++ b/src/stores/user.ts @@ -0,0 +1,102 @@ +import { defineStore } from "pinia"; +import axios from "axios"; +import config from "../config/config"; +import { Base64 } from "js-base64"; + +let timer: any = null; + +export const useUserStore = defineStore("user", { + persist: true, + state: () => ({ + logined: false, + id_token: "", + refresh_token: "", + access_token: "", + expired_at: 0, + user: { + id: 0, + name: "", + email: "", + }, + timer: 0, + }), + actions: { + login( + idToken: string, + accessToken: string, + refreshToken: string, + expiredAt: number, + ) { + const idTokenParts = idToken.split("."); + + const idTokenPayload = JSON.parse(Base64.decode(idTokenParts[1])); + + expiredAt = Date.now() + expiredAt * 1000; + this.expired_at = expiredAt; + + this.refresh_token = refreshToken; + this.access_token = accessToken; + + this.id_token = idToken; + this.user.email = idTokenPayload.email; + this.user.name = idTokenPayload.name; + this.user.id = idTokenPayload.sub; + this.logined = true; + }, + checkAndRefresh() { + if (this.logined) { + if (this.expired_at - Date.now() < 60000) { + this.refresh(); + } + } + }, + setupTimer() { + this.checkAndRefresh(); + timer = setInterval(() => { + this.checkAndRefresh(); + }, 10 * 1000); + }, + async refresh() { + const discovery = await axios.get(config.oauth_discovery_url); + + // post /oauth/token to refresh + // 构建 form 参数 + const data = new URLSearchParams(); + data.set("grant_type", "refresh_token"); + data.set("refresh_token", this.refresh_token); + data.set("client_id", config.oauth_client_id); + data.set("scope", config.oauth_scope); + + axios + .post(discovery.data.token_endpoint, data) + .then((response) => { + this.login( + response.data.id_token, + response.data.access_token, + response.data.refresh_token, + response.data.expires_in, + ); + }) + .catch((error) => { + // if 401 + if (error.response.status === 401) { + console.log("Refresh token failed"); + } + // logout + this.logout(); + clearInterval(timer); + }); + }, + logout() { + this.user = { + id: 0, + name: "", + email: "", + }; + + this.id_token = ""; + this.logined = false; + } + }, +}); + diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000..68a28a8 --- /dev/null +++ b/src/style.css @@ -0,0 +1,7 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +body { + --header-height: 32px; +} diff --git a/src/typed-router.d.ts b/src/typed-router.d.ts new file mode 100644 index 0000000..ce08617 --- /dev/null +++ b/src/typed-router.d.ts @@ -0,0 +1,27 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-router. ‼️ DO NOT MODIFY THIS FILE ‼️ +// It's recommended to commit this file. +// Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry. + +declare module 'vue-router/auto-routes' { + import type { + RouteRecordInfo, + ParamValue, + ParamValueOneOrMore, + ParamValueZeroOrMore, + ParamValueZeroOrOne, + } from 'vue-router' + + /** + * Route name map generated by unplugin-vue-router + */ + export interface RouteNamedMap { + '/': RouteRecordInfo<'/', '/', Record, Record>, + '/auth/callback': RouteRecordInfo<'/auth/callback', '/auth/callback', Record, Record>, + '/auth/continue': RouteRecordInfo<'/auth/continue', '/auth/continue', Record, Record>, + '/auth/login': RouteRecordInfo<'/auth/login', '/auth/login', Record, Record>, + '/guest/': RouteRecordInfo<'/guest/', '/guest', Record, Record>, + } +} diff --git a/src/utils/composables.ts b/src/utils/composables.ts new file mode 100644 index 0000000..0ee8f92 --- /dev/null +++ b/src/utils/composables.ts @@ -0,0 +1,45 @@ +import { inject, provide, reactive, toRef, watchEffect } from 'vue' +import { useBreakpoint, useMemo } from 'vooks' + +export function useIsMobile() { + const breakpointRef = useBreakpoint() + return useMemo(() => { + return breakpointRef.value === 'xs' + }) +} + +export function useIsTablet() { + const breakpointRef = useBreakpoint() + return useMemo(() => { + return breakpointRef.value === 's' + }) +} + +export function useIsSmallDesktop() { + const breakpointRef = useBreakpoint() + return useMemo(() => { + return breakpointRef.value === 'm' + }) +} + +export const i18n = function (data: any) { + const localeReactive = inject('i18n', null) + return { + // @ts-ignore ... + locale: toRef(localeReactive, 'locale'), + t(key: any) { + // @ts-ignore ... + const { locale } = localeReactive + return data[locale][key] + } + } +} + +i18n.provide = function (localeRef: any) { + const localeReactive = reactive({}) + watchEffect(() => { + // @ts-ignore ... + localeReactive.locale = localeRef.value + }) + provide('i18n', localeReactive) +} diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..dcfaef4 --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,7 @@ +/// + +declare module '*.vue' { + import type {DefineComponent} from 'vue' + const component: DefineComponent<{}, {}, any> + export default component +} diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 0000000..45ce112 --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1,8 @@ +/** @type {import('tailwindcss').Config} */ +export default { + content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..811fab0 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "moduleResolution": "Node", + "strict": true, + "jsx": "preserve", + "sourceMap": true, + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": [ + "ESNext", + "DOM" + ], + "skipLibCheck": true, + "types": [ + "unplugin-vue-router/client" + ] + }, + "include": [ + "src/**/*.ts", + "src/**/*.d.ts", + "src/**/*.tsx", + "src/**/*.vue" + ], + "references": [ + { + "path": "./tsconfig.node.json" + } + ] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..b8afcc8 --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true + }, + "include": [ + "vite.config.ts" + ] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..0ef36d4 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,57 @@ +import { defineConfig } from "vite" +import vue from "@vitejs/plugin-vue" +import VueRouter from "unplugin-vue-router/vite" +import Layouts from "vite-plugin-vue-layouts" +import Components from "unplugin-vue-components/vite" +import AutoImport from "unplugin-auto-import/vite" +// import { resolve } from "path"; +// const rootPath = new URL(".", import.meta.url).pathname; + +import { fileURLToPath, URL } from "node:url" +// https://vitejs.dev/config/ +export default defineConfig({ + resolve: { + alias: { + "@": fileURLToPath(new URL("./src", import.meta.url)), + }, + extensions: [".js", ".json", ".jsx", ".mjs", ".ts", ".tsx", ".vue"], + }, + plugins: [ + VueRouter({ + dts: "src/typed-router.d.ts", + routesFolder: [ + { + src: "src/pages", + path: "", + // override globals + exclude: (excluded) => excluded, + filePatterns: (filePatterns) => filePatterns, + extensions: (extensions) => extensions, + }, + ], + }), + vue(), + Layouts(), + AutoImport({ + imports: [ + "vue", + { + "vue-router/auto": ["useRoute", "useRouter"], + }, + ], + dts: "src/auto-imports.d.ts", + eslintrc: { + enabled: true, + }, + vueTemplate: true, + }), + Components({ + dts: "src/components.d.ts", + }), + ], + server: { + host: true, + port: 5173, + strictPort: true, + }, +})