diff --git a/packages/shared-chat/src/types/chat-options.ts b/packages/shared-chat/src/types/chat-options.ts deleted file mode 100644 index 3952cee4..00000000 --- a/packages/shared-chat/src/types/chat-options.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { CommonRequestOptions } from '@xsai/shared' - -import type { Message } from './message' -import type { ToolChoice } from './tool-choice' - -export interface ChatOptions extends CommonRequestOptions { - [key: string]: unknown - messages: Message[] - toolChoice?: ToolChoice -} diff --git a/packages/shared-chat/src/types/index.ts b/packages/shared-chat/src/types/index.ts index ba56499d..ba8567a3 100644 --- a/packages/shared-chat/src/types/index.ts +++ b/packages/shared-chat/src/types/index.ts @@ -1,4 +1,3 @@ -export type * from './chat-options' export type * from './finish-reason' export type * from './message' export type * from './message-part' diff --git a/packages/shared-chat/src/utils/chat.ts b/packages/shared-chat/src/utils/chat.ts index 43e331a2..54902e93 100644 --- a/packages/shared-chat/src/utils/chat.ts +++ b/packages/shared-chat/src/utils/chat.ts @@ -1,6 +1,14 @@ +import type { CommonRequestOptions } from '@xsai/shared' + import { requestBody, requestHeaders, requestURL, responseCatch } from '@xsai/shared' -import type { ChatOptions, Tool } from '../types' +import type { Message, Tool, ToolChoice } from '../types' + +export interface ChatOptions extends CommonRequestOptions { + [key: string]: unknown + messages: Message[] + toolChoice?: ToolChoice +} export const chat = async (options: T) => (options.fetch ?? globalThis.fetch)(requestURL('chat/completions', options.baseURL), { diff --git a/packages/shared-chat/src/utils/index.ts b/packages/shared-chat/src/utils/index.ts index 550d1cb7..5b4f8a8f 100644 --- a/packages/shared-chat/src/utils/index.ts +++ b/packages/shared-chat/src/utils/index.ts @@ -1 +1 @@ -export { chat } from './chat' +export { chat, type ChatOptions } from './chat'