@galaxycore/ai-chat 0.4.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+
5
+ - Assistant text now renders Markdown by default, including headings, lists, tables and fenced code, using the existing streaming renderer. User input remains literal text.
6
+ - Existing `renderText` and part renderer overrides retain precedence.
7
+ - Streamdown is now a runtime dependency, installed automatically. The `/markdown` export remains compatible; `/headless` still does not import the Markdown renderer.
8
+ - Existing unsafe URL/HTML filtering and remote-image blocking remain enabled.
9
+
3
10
  ## 0.4.0
4
11
 
5
12
  ### 历史会话菜单
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  GalaxyCore 通用 React AI 聊天组件。默认界面借鉴 Chrome AI 侧栏和 Codex 的消息阅读、工具状态与输入区布局,使用 Lucide 图标;支持完整面板、组合组件和 headless Hook。不同业务系统可分别适配文档、表格、图表或编辑器上下文,也可以使用自己的主题与组件库。
4
4
 
5
- **当前版本:UI 包 0.4.0,网关包 0.1.0。** UI 提供平滑流式展示、历史会话菜单、语音输入、可部署示例和交互文档站。独立 Node 网关通过 pi core 实现流式文本、服务端工具调用、停止和持久化会话恢复。Codex 已预留运行时扩展接口,尚未实现其桥接。发布验收与真实模型联调状态见 [验证记录](docs/validation.md)。
5
+ **当前版本:UI 包 0.5.0,网关包 0.1.0。** UI 提供平滑流式展示、历史会话菜单、语音输入、可部署示例和交互文档站。独立 Node 网关通过 pi core 实现流式文本、服务端工具调用、停止和持久化会话恢复。Codex 已预留运行时扩展接口,尚未实现其桥接。发布验收与真实模型联调状态见 [验证记录](docs/validation.md)。
6
6
 
7
7
  ## 本地运行
8
8
 
@@ -100,7 +100,7 @@ export function Conversation({ id, initialMessages = [] }: {
100
100
 
101
101
  `gateway.health()` 返回能力,宿主可据此显示功能。当前 pi 网关 `streaming/tools/cancel/sessionRestore=true`,`streamReplay/regenerate/attachments=false`;不要启用当前运行时不支持的重新生成或附件按钮。
102
102
 
103
- 默认回答以安全纯文本显示。Markdown 按需安装 `streamdown@^2.7.0`,再传入 `@galaxycore/ai-chat/markdown` 的 `MarkdownResponse` 作为 `renderText`。包提供基础样式,无需 Tailwind;默认禁用远程图片加载,外链仅接受 HTTP(S)/站内绝对路径。数学公式、Mermaid 等插件由宿主按需接入。
103
+ 助手回答默认渲染 Markdown,用户输入保留原文。Streamdown 随包自动安装;`renderText` 可覆盖默认渲染,`@galaxycore/ai-chat/markdown` 的 `MarkdownResponse` 入口保持兼容。包提供基础样式,无需 Tailwind;默认禁用远程图片加载,外链仅接受 HTTP(S)/站内绝对路径。数学公式、Mermaid 等插件由宿主按需接入。
104
104
 
105
105
  ## 三种使用层次
106
106
 
@@ -110,7 +110,7 @@ export function Conversation({ id, initialMessages = [] }: {
110
110
  | `useAiChat` + `ChatPanel` | 宿主管理会话、工具和上下文,复用默认面板 |
111
111
  | `useAiChat` + `ChatMessages` + `ChatComposer` | 自由组合;完全自定义界面可使用 `/headless` |
112
112
 
113
- `/gateway` 提供浏览器网关客户端;`/context` 提供可选上下文 Hook/Tray;`/markdown` 提供可选 Markdown renderer。服务器运行时位于独立包 `@galaxycore/ai-chat-gateway`,不要从浏览器引入该服务器包。
113
+ `/gateway` 提供浏览器网关客户端;`/context` 提供可选上下文 Hook/Tray;`/markdown` 提供独立 Markdown renderer。服务器运行时位于独立包 `@galaxycore/ai-chat-gateway`,不要从浏览器引入该服务器包。
114
114
 
115
115
  自定义 `renderers[part.type]` 优先于 `tools[toolName]`,再回退到默认展示。支持 text、reasoning、source、file 和静态/动态 tool parts;UI 支持的 part 不代表每个后端都提供该能力。默认工具卡展示状态,通用审批 UI 只应连接实现审批语义的后端;组件不会自行执行工具。
116
116
 
@@ -1,3 +1,3 @@
1
1
  "use client";
2
2
  "use client";
3
- export { n as ChatAppearanceProvider, r as ChatIcon, t as ChatIconButton } from "./ui-primitives-DlZ1hJkr.js";
3
+ export { n as ChatAppearanceProvider, r as ChatIcon, t as ChatIconButton } from "./ui-primitives-BCbe9Ds8.js";
package/dist/context.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  "use client";
3
- import { r as Icon, t as ChatIconButton } from "./ui-primitives-DlZ1hJkr.js";
3
+ import { r as Icon, t as ChatIconButton } from "./ui-primitives-BCbe9Ds8.js";
4
4
  import { useCallback, useEffect, useRef, useState } from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/context.tsx
@@ -1,5 +1,5 @@
1
1
 
2
2
  import { ChatContextAdapter, ChatContextController, ChatContextItem, ChatContextOptions, ChatContextValue, ChatRequestContext, SelectedChatContextItem, TextSelectionAdapterOptions, createTextSelectionAdapter, useChatContext } from "./context.js";
3
3
  import { SpeechInputAdapter, SpeechInputController, SpeechInputError, SpeechInputOptions, SpeechInputResult, SpeechInputSession, SpeechInputStartOptions, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
4
- import { _ as TextRenderer, a as safeUrl, b as ToolPresentationResolver, c as AiChatOptions, d as ChatComposerProps, f as ChatLabels, g as PartRenderers, h as PartRendererProps, i as getMessageText, l as AiChatProps, m as ChatPanelProps, n as zhCN, o as useAiChat, p as ChatMessagesProps, r as acceptsFile, s as AiChatController, t as enUS, u as AttachmentOptions, v as ToolPart, x as ToolRenderers, y as ToolPresentation } from "./labels-BBjaNAlS.js";
5
- export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatLabels, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, safeUrl, useAiChat, useChatContext, useSpeechInput, zhCN };
4
+ import { C as ToolRenderers, S as ToolPresentationResolver, _ as PartRendererProps, a as safeUrl, b as ToolPart, c as AiChatOptions, d as ChatComposerProps, f as ChatLabels, g as ChatSuggestedAction, h as ChatPanelProps, i as getMessageText, l as AiChatProps, m as ChatMessagesProps, n as zhCN, o as useAiChat, p as ChatMessageActionContext, r as acceptsFile, s as AiChatController, t as enUS, u as AttachmentOptions, v as PartRenderers, x as ToolPresentation, y as TextRenderer } from "./labels-D8smv23O.js";
5
+ export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatSuggestedAction, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, safeUrl, useAiChat, useChatContext, useSpeechInput, zhCN };
package/dist/headless.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  "use client";
3
- import { i as useAiChat, r as zhCN, t as enUS } from "./labels-DJsjblzj.js";
3
+ import { i as useAiChat, r as zhCN, t as enUS } from "./labels-BM5o9a9K.js";
4
4
  import { i as safeUrl, r as getMessageText, t as acceptsFile } from "./utils-DqBGBYA1.js";
5
5
  import { SpeechInputError, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
6
6
  import { createTextSelectionAdapter, useChatContext } from "./context.js";
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import { a as ChatIconName, c as Icon, i as ChatAppearanceProviderProps, n as ChatIconButtonProps, o as ChatIconOverrides, r as ChatAppearanceProvider, s as ChatIconProps, t as ChatIconButton } from "./appearance-BUtKwRL5.js";
3
3
  import { ChatContextAdapter, ChatContextController, ChatContextItem, ChatContextOptions, ChatContextValue, ChatRequestContext, ContextTray, ContextTrayLabels, ContextTrayProps, SelectedChatContextItem, TextSelectionAdapterOptions, createTextSelectionAdapter, useChatContext } from "./context.js";
4
4
  import { SpeechInputAdapter, SpeechInputController, SpeechInputError, SpeechInputErrorCode, SpeechInputLabels, SpeechInputOptions, SpeechInputResult, SpeechInputSession, SpeechInputStartOptions, SpeechInputState, SpeechInputSupport, UseSpeechInputOptions, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
5
- import { _ as TextRenderer, b as ToolPresentationResolver, c as AiChatOptions, d as ChatComposerProps, f as ChatLabels, g as PartRenderers, h as PartRendererProps, i as getMessageText, l as AiChatProps, m as ChatPanelProps, n as zhCN, o as useAiChat, p as ChatMessagesProps, s as AiChatController, t as enUS, u as AttachmentOptions, v as ToolPart, x as ToolRenderers, y as ToolPresentation } from "./labels-BBjaNAlS.js";
5
+ import { C as ToolRenderers, S as ToolPresentationResolver, _ as PartRendererProps, b as ToolPart, c as AiChatOptions, d as ChatComposerProps, f as ChatLabels, g as ChatSuggestedAction, h as ChatPanelProps, i as getMessageText, l as AiChatProps, m as ChatMessagesProps, n as zhCN, o as useAiChat, p as ChatMessageActionContext, s as AiChatController, t as enUS, u as AttachmentOptions, v as PartRenderers, x as ToolPresentation, y as TextRenderer } from "./labels-D8smv23O.js";
6
6
  import { HTMLAttributes, ReactNode } from "react";
7
7
  import { UIMessage } from "ai";
8
8
  //#region src/ai-chat.d.ts
@@ -59,5 +59,5 @@ export declare function ChatHistoryMenu({ conversations, currentId, onSelect, on
59
59
  /** Drafts and upload requests are isolated by conversation id. */
60
60
  export declare function ChatComposer<M extends UIMessage = UIMessage>(props: ChatComposerProps<M>): import("react").JSX.Element;
61
61
  //#endregion
62
- export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, ChatAppearanceProvider, type ChatAppearanceProviderProps, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatHistoryItem, type ChatHistoryLabels, type ChatHistoryMenuProps, Icon as ChatIcon, ChatIconButton, type ChatIconButtonProps, type ChatIconName, type ChatIconOverrides, type ChatIconProps, type ChatLabels, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, ContextTray, type ContextTrayLabels, type ContextTrayProps, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputErrorCode, type SpeechInputLabels, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type SpeechInputState, type SpeechInputSupport, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, type UseSpeechInputOptions, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, useAiChat, useChatContext, useSpeechInput, zhCN };
62
+ export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, ChatAppearanceProvider, type ChatAppearanceProviderProps, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatHistoryItem, type ChatHistoryLabels, type ChatHistoryMenuProps, Icon as ChatIcon, ChatIconButton, type ChatIconButtonProps, type ChatIconName, type ChatIconOverrides, type ChatIconProps, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatSuggestedAction, ContextTray, type ContextTrayLabels, type ContextTrayProps, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputErrorCode, type SpeechInputLabels, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type SpeechInputState, type SpeechInputSupport, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, type UseSpeechInputOptions, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, useAiChat, useChatContext, useSpeechInput, zhCN };
63
63
  //# sourceMappingURL=index.d.ts.map