@farris/x-ui 0.2.2 → 0.2.4
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/bubble/src/components/bubble-think/bubble-think.props.d.ts +1 -1
- package/bubble/src/composition/use-widget-content.d.ts +13 -26
- package/common/index.d.ts +1 -0
- package/common/src/use-toolicon.d.ts +5 -0
- package/farris.x-ui.esm.js +3640 -3546
- package/farris.x-ui.umd.cjs +40 -38
- package/index.css +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtractPropTypes, PropType } from '../../../../../vue';
|
|
2
2
|
import { ThinkContent } from '../../../../../../../composition/types';
|
|
3
|
-
import { OutputMode } from '
|
|
3
|
+
import { OutputMode } from '../../../../../../../../../common';
|
|
4
4
|
|
|
5
5
|
export declare const bubbleThinkProps: {
|
|
6
6
|
/** 思考内容 */
|
|
@@ -5,49 +5,36 @@
|
|
|
5
5
|
* 用于解析和处理包含 assistant-widget 代码块的文本内容。
|
|
6
6
|
* 主要处理流式渲染场景下文本被截断的情况,支持识别完整和不完整的 widget 结构。
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* const parts = formatDisplayText('Hello ``` assistant-widget {...} ``` World');
|
|
18
|
-
*
|
|
19
|
-
* // 2. 判断文本是否为 widget 代码块
|
|
20
|
-
* const isWidget = isWidgetBlock('``` assistant-widget {...} ```'); // true
|
|
21
|
-
*
|
|
22
|
-
* // 3. 解析 widget JSON 数据
|
|
23
|
-
* const widgetData = parseAssistantWidget('``` assistant-widget\n{...}\n```');
|
|
24
|
-
*
|
|
25
|
-
* // 4. 获取 widget 实现选项
|
|
26
|
-
* const options = getWidgetImplOptions('``` assistant-widget\n{"renderer":{"widgetImplOptions":{...}}}\n```');
|
|
27
|
-
* ```
|
|
8
|
+
* @支持格式(空白均可选,`\s` 含空格/换行/制表符)
|
|
9
|
+
* - 开围栏:` ```assistant-widget` 与 ` ``` assistant-widget` 等价(``` 与语言标之间)
|
|
10
|
+
* - 语言标:`assistant-widget` 前后均可有空白,如 ` ``` assistant-widget `
|
|
11
|
+
* - 闭围栏:`{...}``` 与 `{...} ``` ` 等价(JSON 正文与 ``` 之间)
|
|
12
|
+
* - 标准:``` assistant-widget {...} ```
|
|
13
|
+
* - 紧凑:```assistant-widget{...}```
|
|
14
|
+
* - 换行:```\nassistant-widget\n{...}\n```
|
|
15
|
+
* - 内联后缀:``` assistant-widget {...}```后续正文(闭围栏后同段仍有文字)
|
|
16
|
+
* - 流式前缀:``` / ```assistant / ```assistant-widget(未闭合;**不含** markdown 代码块闭围栏 ```)
|
|
28
17
|
*
|
|
29
18
|
* @module
|
|
30
19
|
* - `formatDisplayText`: 将含 widget 的文本分割为数组
|
|
31
20
|
* - `isWidgetBlock`: 判断文本是否为完整/不完整的 widget 代码块
|
|
21
|
+
* - `isWidgetBlockComplete`: 判断 widget 是否已闭合
|
|
32
22
|
* - `parseAssistantWidget`: 解析 widget 代码块为 JSON 对象
|
|
33
23
|
* - `getWidgetImplOptions`: 从 widget 数据提取 renderer.widgetImplOptions
|
|
34
24
|
*/
|
|
35
25
|
/**
|
|
36
26
|
* 判断文本是否为完整的 widget 代码块
|
|
37
|
-
* 用于区分流式过程中的 pending / complete 状态:单纯 `endsWith('```')` 会把
|
|
38
|
-
* 仅有一个开围栏 `` ``` `` 的中间态误判为完整 widget。
|
|
39
27
|
*/
|
|
40
28
|
export declare function isWidgetBlockComplete(text: string): boolean;
|
|
41
29
|
/**
|
|
42
|
-
* 判断文本是否为 widget
|
|
43
|
-
* 支持标准格式、不完整格式(流式渲染中途被截断),以及流式起步时仅有围栏前缀的情况
|
|
30
|
+
* 判断文本是否为 widget 代码块(完整 / 未闭合 / 流式前缀)
|
|
44
31
|
*/
|
|
45
32
|
export declare function isWidgetBlock(text: string): boolean;
|
|
46
33
|
/**
|
|
47
34
|
* 解析 displayText,将包含 assistant-widget 代码块的内容分割成多个部分
|
|
48
|
-
* 支持完整和不完整的 widget 结构
|
|
49
|
-
* 支持 ``` 后紧跟换行符 + 空格 + widget类型 的格式
|
|
50
35
|
*/
|
|
51
36
|
export declare function formatDisplayText(displayText: string): string[];
|
|
37
|
+
/** 解析 assistant-widget 内容 */
|
|
52
38
|
export declare function parseAssistantWidget(input: string): any;
|
|
39
|
+
/** 获取 Widget 实现选项 */
|
|
53
40
|
export declare function getWidgetImplOptions(input: string): any;
|
package/common/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export * from '../../src/use-streaming-output';
|
|
|
5
5
|
export * from '../../src/use-sequential-streaming';
|
|
6
6
|
export * from '../../src/use-timer';
|
|
7
7
|
export * from '../../src/types';
|
|
8
|
+
export * from '../../src/use-toolicon';
|
|
8
9
|
export { default as overflowTooltipDirective } from '../../src/overflow-tooltip.directive';
|