@codehz/ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oxfmtrc.json +12 -0
- package/.oxlintrc.json +49 -0
- package/README.md +225 -0
- package/bun.lock +231 -0
- package/dist/index.d.mts +978 -0
- package/dist/index.mjs +2758 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +30 -0
- package/src/adapters/chat-completions.ts +707 -0
- package/src/adapters/index.ts +20 -0
- package/src/adapters/messages.ts +700 -0
- package/src/adapters/ollama.ts +604 -0
- package/src/adapters/responses.ts +516 -0
- package/src/core/aggregator.ts +349 -0
- package/src/core/client.ts +23 -0
- package/src/core/collect-stream.ts +19 -0
- package/src/core/errors.ts +99 -0
- package/src/core/event-factory.ts +141 -0
- package/src/core/index.ts +18 -0
- package/src/core/normalize.ts +51 -0
- package/src/core/validation.ts +341 -0
- package/src/helpers/adapter-auxiliary.ts +181 -0
- package/src/helpers/adapter-base.ts +184 -0
- package/src/helpers/auxiliary-collector.ts +166 -0
- package/src/helpers/index.ts +40 -0
- package/src/helpers/mapping.ts +200 -0
- package/src/helpers/sse-parser.ts +87 -0
- package/src/helpers/synthetic-stream.ts +196 -0
- package/src/index.ts +17 -0
- package/src/types/adapter.ts +109 -0
- package/src/types/content.ts +12 -0
- package/src/types/events.ts +134 -0
- package/src/types/index.ts +59 -0
- package/src/types/items.ts +58 -0
- package/src/types/request.ts +39 -0
- package/src/types/response.ts +65 -0
- package/tsdown.config.ts +10 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 后端适配器
|
|
3
|
+
*
|
|
4
|
+
* 模块边界:各类 AI 后端 adapter 实现。
|
|
5
|
+
* - responses
|
|
6
|
+
* - messages
|
|
7
|
+
* - chat.completions
|
|
8
|
+
* - ollama
|
|
9
|
+
*
|
|
10
|
+
* 每个 adapter 实现 BackendAdapter 内部协议。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { ResponsesAdapter } from "./responses.js";
|
|
14
|
+
export type { ResponsesAdapterOptions } from "./responses.js";
|
|
15
|
+
export { MessagesAdapter } from "./messages.js";
|
|
16
|
+
export type { MessagesAdapterOptions } from "./messages.js";
|
|
17
|
+
export { ChatCompletionsAdapter } from "./chat-completions.js";
|
|
18
|
+
export type { ChatCompletionsAdapterOptions } from "./chat-completions.js";
|
|
19
|
+
export { OllamaAdapter } from "./ollama.js";
|
|
20
|
+
export type { OllamaAdapterOptions } from "./ollama.js";
|