@agentscope-ai/chat 1.2.0-beta.1789618496646 → 1.2.0-beta.1789624266980
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/components/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Message.tsx +3 -1
- package/components/AgentScopeRuntimeWebUI/core/types/IChatAnywhere.ts +5 -0
- package/lib/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Message.js +10 -5
- package/lib/AgentScopeRuntimeWebUI/core/Chat/Input/useMentions.d.ts +1 -1
- package/lib/AgentScopeRuntimeWebUI/core/types/IChatAnywhere.d.ts +5 -0
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
IAgentScopeRuntimeMessage,
|
|
12
12
|
} from '../types';
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/** Apply configured text effects only while live content is streaming. */
|
|
15
15
|
function StreamingText({
|
|
16
16
|
text,
|
|
17
17
|
status,
|
|
@@ -21,6 +21,7 @@ function StreamingText({
|
|
|
21
21
|
status: AgentScopeRuntimeRunStatus;
|
|
22
22
|
messageStatus: AgentScopeRuntimeRunStatus;
|
|
23
23
|
}) {
|
|
24
|
+
const typing = useChatAnywhereOptions((v) => v.response?.typing);
|
|
24
25
|
const animation = useChatAnywhereOptions((v) => v.response?.animation);
|
|
25
26
|
const animationConfig = useChatAnywhereOptions((v) => v.response?.animationConfig);
|
|
26
27
|
const streaming = status === AgentScopeRuntimeRunStatus.InProgress;
|
|
@@ -33,6 +34,7 @@ function StreamingText({
|
|
|
33
34
|
return (
|
|
34
35
|
<Markdown
|
|
35
36
|
content={text}
|
|
37
|
+
typing={streaming && !interrupted ? typing : false}
|
|
36
38
|
animation={Boolean(animation && streaming && !interrupted)}
|
|
37
39
|
animationConfig={animationConfig}
|
|
38
40
|
cursor={!interrupted && streaming}
|
|
@@ -916,6 +916,11 @@ export interface IAgentScopeRuntimeWebUIResponseSlot {
|
|
|
916
916
|
* @descriptionEn Customization options for the assistant response bubble.
|
|
917
917
|
*/
|
|
918
918
|
export interface IAgentScopeRuntimeWebUIResponseOptions {
|
|
919
|
+
/**
|
|
920
|
+
* @description 实时正文打字机效果,默认关闭。true 为每字 5ms,正数为每字间隔毫秒;非正数或非有限值关闭。animation 为 true 时优先渐显。历史消息直接显示,完成或中断时立即显示剩余文字。自定义 render 需调用 fallback() 或复用 SDK Message 才生效。
|
|
921
|
+
* @descriptionEn Typewriter effect for live text, off by default. true uses 5ms per character; a positive number sets the interval in milliseconds. Non-positive or non-finite values disable it. animation takes precedence. History renders immediately; completion or interruption flushes pending text. Custom renderers must use fallback() or the SDK Message component.
|
|
922
|
+
*/
|
|
923
|
+
typing?: MarkdownProps['typing'];
|
|
919
924
|
/**
|
|
920
925
|
* @description 实时正文按新增文本块渐显,默认关闭。复用 Markdown 的 animation,不逐字排队。历史消息及终态不播放动画。自定义 render 需调用 fallback() 或复用 SDK Message 才生效。
|
|
921
926
|
* @descriptionEn Fade in incoming live text chunks, off by default. Reuses Markdown animation without a character queue. History and terminal states do not animate. Custom renderers must use fallback() or the SDK Message component.
|
|
@@ -7,20 +7,24 @@ import Markdown from "../../../../Markdown";
|
|
|
7
7
|
import { useChatAnywhereOptions } from "../../Context/ChatAnywhereOptionsContext";
|
|
8
8
|
import { AgentScopeRuntimeContentType, AgentScopeRuntimeRunStatus } from "../types";
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/** Apply configured text effects only while live content is streaming. */
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
function StreamingText(_ref) {
|
|
14
14
|
var text = _ref.text,
|
|
15
15
|
status = _ref.status,
|
|
16
16
|
messageStatus = _ref.messageStatus;
|
|
17
|
-
var
|
|
17
|
+
var typing = useChatAnywhereOptions(function (v) {
|
|
18
18
|
var _v$response;
|
|
19
|
-
return (_v$response = v.response) === null || _v$response === void 0 ? void 0 : _v$response.
|
|
19
|
+
return (_v$response = v.response) === null || _v$response === void 0 ? void 0 : _v$response.typing;
|
|
20
20
|
});
|
|
21
|
-
var
|
|
21
|
+
var animation = useChatAnywhereOptions(function (v) {
|
|
22
22
|
var _v$response2;
|
|
23
|
-
return (_v$response2 = v.response) === null || _v$response2 === void 0 ? void 0 : _v$response2.
|
|
23
|
+
return (_v$response2 = v.response) === null || _v$response2 === void 0 ? void 0 : _v$response2.animation;
|
|
24
|
+
});
|
|
25
|
+
var animationConfig = useChatAnywhereOptions(function (v) {
|
|
26
|
+
var _v$response3;
|
|
27
|
+
return (_v$response3 = v.response) === null || _v$response3 === void 0 ? void 0 : _v$response3.animationConfig;
|
|
24
28
|
});
|
|
25
29
|
var streaming = status === AgentScopeRuntimeRunStatus.InProgress;
|
|
26
30
|
var interrupted = [status, messageStatus].some(function (value) {
|
|
@@ -28,6 +32,7 @@ function StreamingText(_ref) {
|
|
|
28
32
|
});
|
|
29
33
|
return /*#__PURE__*/_jsx(Markdown, {
|
|
30
34
|
content: text,
|
|
35
|
+
typing: streaming && !interrupted ? typing : false,
|
|
31
36
|
animation: Boolean(animation && streaming && !interrupted),
|
|
32
37
|
animationConfig: animationConfig,
|
|
33
38
|
cursor: !interrupted && streaming
|
|
@@ -11,5 +11,5 @@ export default function useMentions(options: IAgentScopeRuntimeWebUISenderMentio
|
|
|
11
11
|
header: import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
mentions: IAgentScopeRuntimeWebUISenderMentionItem[];
|
|
13
13
|
open: boolean;
|
|
14
|
-
wrapInput: (node: React.ReactNode) => string | number | boolean |
|
|
14
|
+
wrapInput: (node: React.ReactNode) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode>;
|
|
15
15
|
};
|
|
@@ -825,6 +825,11 @@ export interface IAgentScopeRuntimeWebUIResponseSlot {
|
|
|
825
825
|
* @descriptionEn Customization options for the assistant response bubble.
|
|
826
826
|
*/
|
|
827
827
|
export interface IAgentScopeRuntimeWebUIResponseOptions {
|
|
828
|
+
/**
|
|
829
|
+
* @description 实时正文打字机效果,默认关闭。true 为每字 5ms,正数为每字间隔毫秒;非正数或非有限值关闭。animation 为 true 时优先渐显。历史消息直接显示,完成或中断时立即显示剩余文字。自定义 render 需调用 fallback() 或复用 SDK Message 才生效。
|
|
830
|
+
* @descriptionEn Typewriter effect for live text, off by default. true uses 5ms per character; a positive number sets the interval in milliseconds. Non-positive or non-finite values disable it. animation takes precedence. History renders immediately; completion or interruption flushes pending text. Custom renderers must use fallback() or the SDK Message component.
|
|
831
|
+
*/
|
|
832
|
+
typing?: MarkdownProps['typing'];
|
|
828
833
|
/**
|
|
829
834
|
* @description 实时正文按新增文本块渐显,默认关闭。复用 Markdown 的 animation,不逐字排队。历史消息及终态不播放动画。自定义 render 需调用 fallback() 或复用 SDK Message 才生效。
|
|
830
835
|
* @descriptionEn Fade in incoming live text chunks, off by default. Reuses Markdown animation without a character queue. History and terminal states do not animate. Custom renderers must use fallback() or the SDK Message component.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentscope-ai/chat",
|
|
3
|
-
"version": "1.2.0-beta.
|
|
3
|
+
"version": "1.2.0-beta.1789624266980",
|
|
4
4
|
"description": "a free and open-source chat framework for building excellent LLM-powered chat experiences",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": [
|