@codehz/ai 0.4.0 → 0.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codehz/ai",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import { AdapterBase } from "../helpers/adapter-base.js";
12
- import { AIRequestError } from "../core/errors.js";
12
+ import { AIRequestError, WarningCode } from "../core/errors.js";
13
13
  import {
14
14
  textBlock,
15
15
  messageItem,
@@ -596,7 +596,7 @@ export class ChatCompletionsAdapter extends AdapterBase {
596
596
  }
597
597
 
598
598
  if (!gate.completed && (hasMessageStarted || hasReasoningStarted || pendingToolCalls.size > 0)) {
599
- yield factory.responseWarning("Stream ended without a finish_reason", "INCOMPLETE_STREAM");
599
+ yield factory.responseWarning("Stream ended without a finish_reason", WarningCode.STREAM_INCOMPLETE);
600
600
  const { events, assistantReplayMessage } = finalizePendingTurn();
601
601
  for (const event of events) yield event;
602
602
  yield* emitCompleted(undefined, assistantReplayMessage, responseId);
@@ -478,7 +478,7 @@ export class OllamaAdapter extends AdapterBase {
478
478
  }
479
479
 
480
480
  if (!gate.completed && (hasMessageStarted || pendingToolCalls.length > 0)) {
481
- yield factory.responseWarning("Stream ended without a done signal", "INCOMPLETE_STREAM");
481
+ yield factory.responseWarning("Stream ended without a done signal", WarningCode.STREAM_INCOMPLETE);
482
482
 
483
483
  if (hasMessageStarted) {
484
484
  const message = messageItem([textBlock(accumulatedContent)], { id: currentMessageId });