@adminide-stack/yantra-mobile 12.0.55-alpha.2 → 12.0.55-alpha.3
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/lib/components/KeyboardComposerDock.js +2 -2
- package/lib/components/KeyboardComposerDock.js.map +1 -1
- package/lib/components/ThinkingIndicator.js +123 -35
- package/lib/components/ThinkingIndicator.js.map +1 -1
- package/lib/contexts/ChatLiveStreamContext.js +54 -0
- package/lib/contexts/ChatLiveStreamContext.js.map +1 -0
- package/lib/features/agent-chat/NativeAgentChat.js +1 -1
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/chat/AssistantMarkdown.js +313 -0
- package/lib/features/chat/AssistantMarkdown.js.map +1 -0
- package/lib/features/chat/ChatCodeBlock.js +94 -0
- package/lib/features/chat/ChatCodeBlock.js.map +1 -0
- package/lib/features/chat/ChatTranscript.js +8 -91
- package/lib/features/chat/ChatTranscript.js.map +1 -1
- package/lib/features/chat/emptyChatResponse.js +7 -0
- package/lib/features/chat/emptyChatResponse.js.map +1 -0
- package/lib/features/chat/preResponse.js +23 -0
- package/lib/features/chat/preResponse.js.map +1 -0
- package/lib/features/chat/streamingMarkdown.js +125 -1
- package/lib/features/chat/streamingMarkdown.js.map +1 -1
- package/lib/features/chat/toolActivity.js +19 -9
- package/lib/features/chat/toolActivity.js.map +1 -1
- package/lib/hooks/useCdecliChannel.js +118 -51
- package/lib/hooks/useCdecliChannel.js.map +1 -1
- package/lib/hooks/useChatApi.js +152 -48
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/useChatStream.js +31 -10
- package/lib/hooks/useChatStream.js.map +1 -1
- package/lib/hooks/useLiveThinkingLabel.js +22 -0
- package/lib/hooks/useLiveThinkingLabel.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/screens/Chat/index.js +36 -47
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/Home/components/ChatHistoryLanding.js +78 -23
- package/lib/screens/Home/components/ChatHistoryLanding.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import {memo,useMemo}from'react';import {Platform,StyleSheet,ScrollView,View,Text,Linking}from'react-native';import Markdown,{MarkdownIt,hasParents}from'react-native-markdown-display';import {ChatCodeBlock}from'./ChatCodeBlock.js';import {prepareAssistantMarkdown}from'./streamingMarkdown.js';const ASSISTANT_MARKDOWN_IT = MarkdownIt({
|
|
2
|
+
html: false,
|
|
3
|
+
breaks: true,
|
|
4
|
+
linkify: true,
|
|
5
|
+
typographer: true
|
|
6
|
+
});
|
|
7
|
+
function flattenNodeText(node) {
|
|
8
|
+
var _a;
|
|
9
|
+
if (!node) return "";
|
|
10
|
+
const own = typeof node.content === "string" ? node.content : "";
|
|
11
|
+
const kids = ((_a = node.children) != null ? _a : []).map(flattenNodeText).join("");
|
|
12
|
+
return own + kids;
|
|
13
|
+
}
|
|
14
|
+
function fenceNodeContent(node) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const language = (node.sourceInfo || "").trim() || "code";
|
|
17
|
+
const raw = String((_a = node.content) != null ? _a : "").trim() ? String((_b = node.content) != null ? _b : "") : flattenNodeText(node);
|
|
18
|
+
return {
|
|
19
|
+
language,
|
|
20
|
+
code: raw.replace(/\n$/, "")
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function openMarkdownLink(url) {
|
|
24
|
+
void Linking.openURL(url);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const AssistantMarkdown = memo(function AssistantMarkdown2({
|
|
28
|
+
text,
|
|
29
|
+
streaming = false,
|
|
30
|
+
isDark = false
|
|
31
|
+
}) {
|
|
32
|
+
const source = useMemo(() => prepareAssistantMarkdown(text, streaming), [text, streaming]);
|
|
33
|
+
const style = useMemo(() => assistantMarkdownStyle(isDark), [isDark]);
|
|
34
|
+
const rules = useMemo(() => assistantMarkdownRules(isDark), [isDark]);
|
|
35
|
+
if (!source.trim()) return null;
|
|
36
|
+
return /* @__PURE__ */ jsx(Markdown, { markdownit: ASSISTANT_MARKDOWN_IT, style, rules, onLinkPress: openMarkdownLink, children: source });
|
|
37
|
+
});
|
|
38
|
+
function assistantMarkdownRules(isDark) {
|
|
39
|
+
const ink = isDark ? "#f3f5f8" : "#121926";
|
|
40
|
+
const muted = isDark ? "#aab3c2" : "#667085";
|
|
41
|
+
return {
|
|
42
|
+
fence: (node) => {
|
|
43
|
+
const {
|
|
44
|
+
language,
|
|
45
|
+
code
|
|
46
|
+
} = fenceNodeContent(node);
|
|
47
|
+
return /* @__PURE__ */ jsx(ChatCodeBlock, { language, code, isDark }, node.key);
|
|
48
|
+
},
|
|
49
|
+
code_block: (node) => {
|
|
50
|
+
const {
|
|
51
|
+
language,
|
|
52
|
+
code
|
|
53
|
+
} = fenceNodeContent(node);
|
|
54
|
+
return /* @__PURE__ */ jsx(ChatCodeBlock, { language, code: code || flattenNodeText(node), isDark }, node.key);
|
|
55
|
+
},
|
|
56
|
+
html_inline: (node) => /* @__PURE__ */ jsx(Text, { children: node.content }, node.key),
|
|
57
|
+
html_block: (node) => /* @__PURE__ */ jsx(Text, { children: node.content }, node.key),
|
|
58
|
+
// View + flexWrap rows clip mixed inline code and inflate list gaps.
|
|
59
|
+
// Render copy as Text (same as web <p>) so lines wrap.
|
|
60
|
+
paragraph: (node, children, parent) => {
|
|
61
|
+
const inList = hasParents(parent, "list_item");
|
|
62
|
+
return /* @__PURE__ */ jsx(Text, { style: inList ? [local.p, local.pInList, {
|
|
63
|
+
color: ink
|
|
64
|
+
}] : [local.p, {
|
|
65
|
+
color: ink
|
|
66
|
+
}], children }, node.key);
|
|
67
|
+
},
|
|
68
|
+
hardbreak: (node) => /* @__PURE__ */ jsx(Text, { children: "\n" }, node.key),
|
|
69
|
+
softbreak: (node) => /* @__PURE__ */ jsx(Text, { children: " " }, node.key),
|
|
70
|
+
list_item: (node, children, parent) => {
|
|
71
|
+
var _a, _b, _c;
|
|
72
|
+
if (hasParents(parent, "bullet_list")) {
|
|
73
|
+
return /* @__PURE__ */ jsxs(View, { style: local.li, children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Text, { style: [local.bullet, {
|
|
75
|
+
color: muted
|
|
76
|
+
}], accessible: false, children: "\u2022" }),
|
|
77
|
+
/* @__PURE__ */ jsx(View, { style: local.liBody, children })
|
|
78
|
+
] }, node.key);
|
|
79
|
+
}
|
|
80
|
+
if (hasParents(parent, "ordered_list")) {
|
|
81
|
+
const ordered = [...parent].reverse().find((el) => (el == null ? void 0 : el.type) === "ordered_list");
|
|
82
|
+
const start = (_b = (_a = ordered == null ? void 0 : ordered.attributes) == null ? void 0 : _a.start) != null ? _b : 1;
|
|
83
|
+
const n = start + ((_c = node.index) != null ? _c : 0);
|
|
84
|
+
return /* @__PURE__ */ jsxs(View, { style: local.li, children: [
|
|
85
|
+
/* @__PURE__ */ jsxs(Text, { style: [local.olMarker, {
|
|
86
|
+
color: muted
|
|
87
|
+
}], children: [
|
|
88
|
+
n,
|
|
89
|
+
"."
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ jsx(View, { style: local.liBody, children })
|
|
92
|
+
] }, node.key);
|
|
93
|
+
}
|
|
94
|
+
return /* @__PURE__ */ jsx(View, { style: local.li, children }, node.key);
|
|
95
|
+
},
|
|
96
|
+
table: (node, children, _parent, styles) => /* @__PURE__ */ jsx(ScrollView, { horizontal: true, nestedScrollEnabled: true, showsHorizontalScrollIndicator: false, style: local.tableScroll, contentContainerStyle: local.tableScrollContent, children: /* @__PURE__ */ jsx(View, { style: styles._VIEW_SAFE_table, children }) }, node.key)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function assistantMarkdownStyle(isDark) {
|
|
100
|
+
const ink = isDark ? "#f3f5f8" : "#121926";
|
|
101
|
+
const muted = isDark ? "#aab3c2" : "#667085";
|
|
102
|
+
const border = isDark ? "#2a3240" : "#e3e7ee";
|
|
103
|
+
const borderStrong = isDark ? "#364052" : "#cfd7e3";
|
|
104
|
+
const surface = isDark ? "#171a20" : "#f6f7f8";
|
|
105
|
+
const inlineBg = isDark ? "rgba(251, 146, 60, 0.14)" : "rgba(249, 115, 22, 0.1)";
|
|
106
|
+
const inlineFg = isDark ? "#ffb36b" : "#d96b00";
|
|
107
|
+
const mono = Platform.OS === "ios" ? "Menlo" : "monospace";
|
|
108
|
+
return {
|
|
109
|
+
body: {
|
|
110
|
+
color: ink,
|
|
111
|
+
fontSize: 16,
|
|
112
|
+
lineHeight: 26
|
|
113
|
+
},
|
|
114
|
+
heading1: {
|
|
115
|
+
flexDirection: "row",
|
|
116
|
+
fontSize: 22,
|
|
117
|
+
fontWeight: "600",
|
|
118
|
+
letterSpacing: -0.3,
|
|
119
|
+
marginTop: 22,
|
|
120
|
+
marginBottom: 12,
|
|
121
|
+
color: ink
|
|
122
|
+
},
|
|
123
|
+
heading2: {
|
|
124
|
+
flexDirection: "row",
|
|
125
|
+
fontSize: 20,
|
|
126
|
+
fontWeight: "600",
|
|
127
|
+
letterSpacing: -0.3,
|
|
128
|
+
marginTop: 20,
|
|
129
|
+
marginBottom: 10,
|
|
130
|
+
color: ink
|
|
131
|
+
},
|
|
132
|
+
heading3: {
|
|
133
|
+
flexDirection: "row",
|
|
134
|
+
fontSize: 18,
|
|
135
|
+
fontWeight: "600",
|
|
136
|
+
marginTop: 16,
|
|
137
|
+
marginBottom: 8,
|
|
138
|
+
color: ink
|
|
139
|
+
},
|
|
140
|
+
heading4: {
|
|
141
|
+
flexDirection: "row",
|
|
142
|
+
fontSize: 16,
|
|
143
|
+
fontWeight: "600",
|
|
144
|
+
marginTop: 14,
|
|
145
|
+
marginBottom: 6,
|
|
146
|
+
color: ink
|
|
147
|
+
},
|
|
148
|
+
heading5: {
|
|
149
|
+
flexDirection: "row",
|
|
150
|
+
fontSize: 15,
|
|
151
|
+
fontWeight: "600",
|
|
152
|
+
marginTop: 12,
|
|
153
|
+
marginBottom: 6,
|
|
154
|
+
color: ink
|
|
155
|
+
},
|
|
156
|
+
heading6: {
|
|
157
|
+
flexDirection: "row",
|
|
158
|
+
fontSize: 14,
|
|
159
|
+
fontWeight: "600",
|
|
160
|
+
marginTop: 12,
|
|
161
|
+
marginBottom: 6,
|
|
162
|
+
color: ink
|
|
163
|
+
},
|
|
164
|
+
hr: {
|
|
165
|
+
backgroundColor: border,
|
|
166
|
+
height: StyleSheet.hairlineWidth,
|
|
167
|
+
marginVertical: 20
|
|
168
|
+
},
|
|
169
|
+
strong: {
|
|
170
|
+
fontWeight: "600",
|
|
171
|
+
color: ink
|
|
172
|
+
},
|
|
173
|
+
em: {
|
|
174
|
+
fontStyle: "italic",
|
|
175
|
+
color: muted
|
|
176
|
+
},
|
|
177
|
+
s: {
|
|
178
|
+
textDecorationLine: "line-through"
|
|
179
|
+
},
|
|
180
|
+
paragraph: {
|
|
181
|
+
marginTop: 0,
|
|
182
|
+
marginBottom: 0,
|
|
183
|
+
color: ink
|
|
184
|
+
},
|
|
185
|
+
text: {
|
|
186
|
+
color: ink
|
|
187
|
+
},
|
|
188
|
+
blockquote: {
|
|
189
|
+
backgroundColor: "transparent",
|
|
190
|
+
borderColor: borderStrong,
|
|
191
|
+
borderLeftWidth: 2,
|
|
192
|
+
marginLeft: 0,
|
|
193
|
+
marginVertical: 16,
|
|
194
|
+
paddingHorizontal: 16,
|
|
195
|
+
paddingVertical: 4
|
|
196
|
+
},
|
|
197
|
+
bullet_list: {
|
|
198
|
+
marginTop: 4,
|
|
199
|
+
marginBottom: 16
|
|
200
|
+
},
|
|
201
|
+
ordered_list: {
|
|
202
|
+
marginTop: 4,
|
|
203
|
+
marginBottom: 16
|
|
204
|
+
},
|
|
205
|
+
list_item: {
|
|
206
|
+
marginVertical: 0,
|
|
207
|
+
flexDirection: "row",
|
|
208
|
+
alignItems: "flex-start"
|
|
209
|
+
},
|
|
210
|
+
bullet_list_icon: {
|
|
211
|
+
color: muted
|
|
212
|
+
},
|
|
213
|
+
ordered_list_icon: {
|
|
214
|
+
color: muted
|
|
215
|
+
},
|
|
216
|
+
bullet_list_content: {
|
|
217
|
+
flexGrow: 0,
|
|
218
|
+
flexShrink: 1,
|
|
219
|
+
minWidth: 0
|
|
220
|
+
},
|
|
221
|
+
ordered_list_content: {
|
|
222
|
+
flexGrow: 0,
|
|
223
|
+
flexShrink: 1,
|
|
224
|
+
minWidth: 0
|
|
225
|
+
},
|
|
226
|
+
code_inline: {
|
|
227
|
+
borderWidth: 0,
|
|
228
|
+
padding: 0,
|
|
229
|
+
paddingHorizontal: 6,
|
|
230
|
+
paddingVertical: 2,
|
|
231
|
+
borderRadius: 5,
|
|
232
|
+
backgroundColor: inlineBg,
|
|
233
|
+
color: inlineFg,
|
|
234
|
+
fontSize: 14,
|
|
235
|
+
fontFamily: mono
|
|
236
|
+
},
|
|
237
|
+
table: {
|
|
238
|
+
borderWidth: 1,
|
|
239
|
+
borderColor: border,
|
|
240
|
+
borderRadius: 12,
|
|
241
|
+
marginVertical: 12,
|
|
242
|
+
overflow: "hidden"
|
|
243
|
+
},
|
|
244
|
+
thead: {
|
|
245
|
+
backgroundColor: surface
|
|
246
|
+
},
|
|
247
|
+
th: {
|
|
248
|
+
flex: 1,
|
|
249
|
+
paddingVertical: 10,
|
|
250
|
+
paddingHorizontal: 12,
|
|
251
|
+
fontWeight: "600",
|
|
252
|
+
fontSize: 12,
|
|
253
|
+
color: muted
|
|
254
|
+
},
|
|
255
|
+
td: {
|
|
256
|
+
flex: 1,
|
|
257
|
+
paddingVertical: 10,
|
|
258
|
+
paddingHorizontal: 12,
|
|
259
|
+
color: ink
|
|
260
|
+
},
|
|
261
|
+
tr: {
|
|
262
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
263
|
+
borderColor: border,
|
|
264
|
+
flexDirection: "row"
|
|
265
|
+
},
|
|
266
|
+
link: {
|
|
267
|
+
color: ink,
|
|
268
|
+
textDecorationLine: "underline"
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
const local = StyleSheet.create({
|
|
273
|
+
p: {
|
|
274
|
+
fontSize: 16,
|
|
275
|
+
lineHeight: 26,
|
|
276
|
+
marginBottom: 16
|
|
277
|
+
},
|
|
278
|
+
pInList: {
|
|
279
|
+
marginBottom: 0
|
|
280
|
+
},
|
|
281
|
+
li: {
|
|
282
|
+
flexDirection: "row",
|
|
283
|
+
alignItems: "flex-start",
|
|
284
|
+
width: "100%",
|
|
285
|
+
marginVertical: 5,
|
|
286
|
+
flexGrow: 0
|
|
287
|
+
},
|
|
288
|
+
liBody: {
|
|
289
|
+
flex: 1,
|
|
290
|
+
minWidth: 0,
|
|
291
|
+
flexShrink: 1,
|
|
292
|
+
flexGrow: 1
|
|
293
|
+
},
|
|
294
|
+
bullet: {
|
|
295
|
+
width: 18,
|
|
296
|
+
fontSize: 16,
|
|
297
|
+
lineHeight: 26,
|
|
298
|
+
marginRight: 6
|
|
299
|
+
},
|
|
300
|
+
olMarker: {
|
|
301
|
+
minWidth: 22,
|
|
302
|
+
fontSize: 16,
|
|
303
|
+
lineHeight: 26,
|
|
304
|
+
marginRight: 8
|
|
305
|
+
},
|
|
306
|
+
tableScroll: {
|
|
307
|
+
flexGrow: 0,
|
|
308
|
+
marginVertical: 8
|
|
309
|
+
},
|
|
310
|
+
tableScrollContent: {
|
|
311
|
+
flexGrow: 0
|
|
312
|
+
}
|
|
313
|
+
});export{AssistantMarkdown};//# sourceMappingURL=AssistantMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssistantMarkdown.js","sources":["../../../src/features/chat/AssistantMarkdown.tsx"],"sourcesContent":["/**\n * Native stand-in for browser `FormattedMessageContent` (remark-gfm +\n * CodeBlockWithActions). Same GFM surface: headings, lists, tables, quotes,\n * autolinks, orange inline code, wrapping fenced cards.\n */\nimport React, { memo, useMemo } from 'react';\nimport { Linking, Platform, ScrollView, StyleSheet, Text as RNText, View } from 'react-native';\nimport Markdown, { MarkdownIt, hasParents } from 'react-native-markdown-display';\nimport { ChatCodeBlock } from './ChatCodeBlock';\nimport { prepareAssistantMarkdown } from './streamingMarkdown';\n\nconst ASSISTANT_MARKDOWN_IT = MarkdownIt({\n html: false,\n breaks: true,\n linkify: true,\n typographer: true,\n});\n\ntype FenceNode = {\n key?: string;\n content?: string;\n sourceInfo?: string;\n children?: Array<{ content?: string; children?: FenceNode['children'] }>;\n};\n\nfunction flattenNodeText(node: { content?: string; children?: FenceNode['children'] } | undefined): string {\n if (!node) return '';\n const own = typeof node.content === 'string' ? node.content : '';\n const kids = (node.children ?? []).map(flattenNodeText).join('');\n return own + kids;\n}\n\nfunction fenceNodeContent(node: FenceNode): { language: string; code: string } {\n const language = (node.sourceInfo || '').trim() || 'code';\n const raw = String(node.content ?? '').trim() ? String(node.content ?? '') : flattenNodeText(node);\n return { language, code: raw.replace(/\\n$/, '') };\n}\n\nfunction openMarkdownLink(url: string) {\n void Linking.openURL(url);\n return false;\n}\n\nexport const AssistantMarkdown = memo(function AssistantMarkdown({\n text,\n streaming = false,\n isDark = false,\n}: {\n text: string;\n streaming?: boolean;\n isDark?: boolean;\n}) {\n const source = useMemo(() => prepareAssistantMarkdown(text, streaming), [text, streaming]);\n const style = useMemo(() => assistantMarkdownStyle(isDark), [isDark]);\n const rules = useMemo(() => assistantMarkdownRules(isDark), [isDark]);\n if (!source.trim()) return null;\n return (\n <Markdown markdownit={ASSISTANT_MARKDOWN_IT} style={style} rules={rules} onLinkPress={openMarkdownLink}>\n {source}\n </Markdown>\n );\n});\n\nfunction assistantMarkdownRules(isDark: boolean) {\n const ink = isDark ? '#f3f5f8' : '#121926';\n const muted = isDark ? '#aab3c2' : '#667085';\n return {\n fence: (node: FenceNode) => {\n const { language, code } = fenceNodeContent(node);\n return <ChatCodeBlock key={node.key} language={language} code={code} isDark={isDark} />;\n },\n code_block: (node: FenceNode) => {\n const { language, code } = fenceNodeContent(node);\n return (\n <ChatCodeBlock\n key={node.key}\n language={language}\n code={code || flattenNodeText(node)}\n isDark={isDark}\n />\n );\n },\n html_inline: (node: { key?: string; content?: string }) => <RNText key={node.key}>{node.content}</RNText>,\n html_block: (node: { key?: string; content?: string }) => <RNText key={node.key}>{node.content}</RNText>,\n // View + flexWrap rows clip mixed inline code and inflate list gaps.\n // Render copy as Text (same as web <p>) so lines wrap.\n paragraph: (node: { key?: string }, children: React.ReactNode[], parent: unknown[]) => {\n const inList = hasParents(parent, 'list_item');\n return (\n <RNText\n key={node.key}\n style={inList ? [local.p, local.pInList, { color: ink }] : [local.p, { color: ink }]}\n >\n {children}\n </RNText>\n );\n },\n hardbreak: (node: { key?: string }) => <RNText key={node.key}>{'\\n'}</RNText>,\n softbreak: (node: { key?: string }) => <RNText key={node.key}> </RNText>,\n list_item: (\n node: { key?: string; index?: number; markup?: string },\n children: React.ReactNode[],\n parent: unknown[],\n ) => {\n if (hasParents(parent, 'bullet_list')) {\n return (\n <View key={node.key} style={local.li}>\n <RNText style={[local.bullet, { color: muted }]} accessible={false}>\n {'\\u2022'}\n </RNText>\n <View style={local.liBody}>{children}</View>\n </View>\n );\n }\n if (hasParents(parent, 'ordered_list')) {\n const ordered = [...parent].reverse().find((el: { type?: string }) => el?.type === 'ordered_list') as\n | { attributes?: { start?: number } }\n | undefined;\n const start = ordered?.attributes?.start ?? 1;\n const n = start + (node.index ?? 0);\n return (\n <View key={node.key} style={local.li}>\n <RNText style={[local.olMarker, { color: muted }]}>{n}.</RNText>\n <View style={local.liBody}>{children}</View>\n </View>\n );\n }\n return (\n <View key={node.key} style={local.li}>\n {children}\n </View>\n );\n },\n table: (\n node: { key?: string },\n children: React.ReactNode[],\n _parent: unknown,\n styles: Record<string, unknown>,\n ) => (\n <ScrollView\n key={node.key}\n horizontal\n nestedScrollEnabled\n showsHorizontalScrollIndicator={false}\n style={local.tableScroll}\n contentContainerStyle={local.tableScrollContent}\n >\n <View style={styles._VIEW_SAFE_table as object}>{children}</View>\n </ScrollView>\n ),\n };\n}\n\nfunction assistantMarkdownStyle(isDark: boolean) {\n const ink = isDark ? '#f3f5f8' : '#121926';\n const muted = isDark ? '#aab3c2' : '#667085';\n const border = isDark ? '#2a3240' : '#e3e7ee';\n const borderStrong = isDark ? '#364052' : '#cfd7e3';\n const surface = isDark ? '#171a20' : '#f6f7f8';\n const inlineBg = isDark ? 'rgba(251, 146, 60, 0.14)' : 'rgba(249, 115, 22, 0.1)';\n const inlineFg = isDark ? '#ffb36b' : '#d96b00';\n const mono = Platform.OS === 'ios' ? 'Menlo' : 'monospace';\n\n return {\n body: {\n color: ink,\n fontSize: 16,\n lineHeight: 26,\n },\n heading1: {\n flexDirection: 'row' as const,\n fontSize: 22,\n fontWeight: '600' as const,\n letterSpacing: -0.3,\n marginTop: 22,\n marginBottom: 12,\n color: ink,\n },\n heading2: {\n flexDirection: 'row' as const,\n fontSize: 20,\n fontWeight: '600' as const,\n letterSpacing: -0.3,\n marginTop: 20,\n marginBottom: 10,\n color: ink,\n },\n heading3: {\n flexDirection: 'row' as const,\n fontSize: 18,\n fontWeight: '600' as const,\n marginTop: 16,\n marginBottom: 8,\n color: ink,\n },\n heading4: {\n flexDirection: 'row' as const,\n fontSize: 16,\n fontWeight: '600' as const,\n marginTop: 14,\n marginBottom: 6,\n color: ink,\n },\n heading5: {\n flexDirection: 'row' as const,\n fontSize: 15,\n fontWeight: '600' as const,\n marginTop: 12,\n marginBottom: 6,\n color: ink,\n },\n heading6: {\n flexDirection: 'row' as const,\n fontSize: 14,\n fontWeight: '600' as const,\n marginTop: 12,\n marginBottom: 6,\n color: ink,\n },\n hr: {\n backgroundColor: border,\n height: StyleSheet.hairlineWidth,\n marginVertical: 20,\n },\n strong: { fontWeight: '600' as const, color: ink },\n em: { fontStyle: 'italic' as const, color: muted },\n s: { textDecorationLine: 'line-through' as const },\n paragraph: {\n marginTop: 0,\n marginBottom: 0,\n color: ink,\n },\n text: { color: ink },\n blockquote: {\n backgroundColor: 'transparent',\n borderColor: borderStrong,\n borderLeftWidth: 2,\n marginLeft: 0,\n marginVertical: 16,\n paddingHorizontal: 16,\n paddingVertical: 4,\n },\n bullet_list: { marginTop: 4, marginBottom: 16 },\n ordered_list: { marginTop: 4, marginBottom: 16 },\n list_item: {\n marginVertical: 0,\n flexDirection: 'row' as const,\n alignItems: 'flex-start' as const,\n },\n bullet_list_icon: { color: muted },\n ordered_list_icon: { color: muted },\n bullet_list_content: { flexGrow: 0, flexShrink: 1, minWidth: 0 },\n ordered_list_content: { flexGrow: 0, flexShrink: 1, minWidth: 0 },\n code_inline: {\n borderWidth: 0,\n padding: 0,\n paddingHorizontal: 6,\n paddingVertical: 2,\n borderRadius: 5,\n backgroundColor: inlineBg,\n color: inlineFg,\n fontSize: 14,\n fontFamily: mono,\n },\n table: {\n borderWidth: 1,\n borderColor: border,\n borderRadius: 12,\n marginVertical: 12,\n overflow: 'hidden',\n },\n thead: { backgroundColor: surface },\n th: {\n flex: 1,\n paddingVertical: 10,\n paddingHorizontal: 12,\n fontWeight: '600' as const,\n fontSize: 12,\n color: muted,\n },\n td: {\n flex: 1,\n paddingVertical: 10,\n paddingHorizontal: 12,\n color: ink,\n },\n tr: {\n borderBottomWidth: StyleSheet.hairlineWidth,\n borderColor: border,\n flexDirection: 'row' as const,\n },\n link: {\n color: ink,\n textDecorationLine: 'underline' as const,\n },\n };\n}\n\nconst local = StyleSheet.create({\n p: {\n fontSize: 16,\n lineHeight: 26,\n marginBottom: 16,\n },\n pInList: {\n marginBottom: 0,\n },\n li: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n width: '100%',\n marginVertical: 5,\n flexGrow: 0,\n },\n liBody: {\n flex: 1,\n minWidth: 0,\n flexShrink: 1,\n flexGrow: 1,\n },\n bullet: {\n width: 18,\n fontSize: 16,\n lineHeight: 26,\n marginRight: 6,\n },\n olMarker: {\n minWidth: 22,\n fontSize: 16,\n lineHeight: 26,\n marginRight: 8,\n },\n tableScroll: { flexGrow: 0, marginVertical: 8 },\n tableScrollContent: { flexGrow: 0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CAAC,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {memo,useState,useRef,useEffect,useCallback}from'react';import {Clipboard,Share,View,StyleSheet,Pressable,Platform}from'react-native';import {Feather}from'@expo/vector-icons';import {Text}from'@admin-layout/gluestack-ui-mobile';const ChatCodeBlock = memo(function ChatCodeBlock2({
|
|
2
|
+
language,
|
|
3
|
+
code,
|
|
4
|
+
isDark = false
|
|
5
|
+
}) {
|
|
6
|
+
const label = ((language || "code").trim() || "code").toUpperCase();
|
|
7
|
+
const body = code.replace(/\n$/, "");
|
|
8
|
+
const [copied, setCopied] = useState(false);
|
|
9
|
+
const copiedTimer = useRef(null);
|
|
10
|
+
useEffect(() => () => {
|
|
11
|
+
if (copiedTimer.current) clearTimeout(copiedTimer.current);
|
|
12
|
+
}, []);
|
|
13
|
+
const handleCopy = useCallback(() => {
|
|
14
|
+
Clipboard.setString(body);
|
|
15
|
+
setCopied(true);
|
|
16
|
+
if (copiedTimer.current) clearTimeout(copiedTimer.current);
|
|
17
|
+
copiedTimer.current = setTimeout(() => setCopied(false), 2e3);
|
|
18
|
+
}, [body]);
|
|
19
|
+
const handleDownload = useCallback(() => {
|
|
20
|
+
const ext = language === "jsx" || language === "tsx" ? "tsx" : language === "js" || language === "ts" ? "ts" : "txt";
|
|
21
|
+
void Share.share({
|
|
22
|
+
message: body,
|
|
23
|
+
title: `snippet.${ext}`
|
|
24
|
+
});
|
|
25
|
+
}, [body, language]);
|
|
26
|
+
const border = isDark ? "rgba(148, 163, 184, 0.28)" : "#ebeef3";
|
|
27
|
+
const headerBg = isDark ? "rgba(148, 163, 184, 0.10)" : "#f6f7f8";
|
|
28
|
+
const bodyBg = isDark ? "#171a20" : "#ffffff";
|
|
29
|
+
const muted = isDark ? "#94a3b8" : "#667085";
|
|
30
|
+
const ink = isDark ? "#f3f5f8" : "#121926";
|
|
31
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.wrap, {
|
|
32
|
+
borderColor: border,
|
|
33
|
+
backgroundColor: bodyBg
|
|
34
|
+
}], children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.header, {
|
|
36
|
+
backgroundColor: headerBg,
|
|
37
|
+
borderBottomColor: border
|
|
38
|
+
}], children: [
|
|
39
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.lang, {
|
|
40
|
+
color: muted
|
|
41
|
+
}], children: label }),
|
|
42
|
+
/* @__PURE__ */ jsx(Pressable, { onPress: handleCopy, hitSlop: 8, accessibilityRole: "button", accessibilityLabel: copied ? "Copied" : "Copy code", children: /* @__PURE__ */ jsx(Feather, { name: copied ? "check" : "copy", size: 14, color: copied ? "#10b981" : muted }) })
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsx(Text, { selectable: true, style: [styles.code, {
|
|
45
|
+
color: ink
|
|
46
|
+
}], children: body }),
|
|
47
|
+
/* @__PURE__ */ jsxs(View, { style: styles.footer, children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Pressable, { onPress: handleCopy, hitSlop: 8, accessibilityRole: "button", accessibilityLabel: copied ? "Copied" : "Copy code", style: styles.footerBtn, children: /* @__PURE__ */ jsx(Feather, { name: copied ? "check" : "copy", size: 15, color: copied ? "#10b981" : muted }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(Pressable, { onPress: handleDownload, hitSlop: 8, accessibilityRole: "button", accessibilityLabel: "Share code", style: styles.footerBtn, children: /* @__PURE__ */ jsx(Feather, { name: "download", size: 15, color: muted }) })
|
|
50
|
+
] })
|
|
51
|
+
] });
|
|
52
|
+
});
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
wrap: {
|
|
55
|
+
alignSelf: "stretch",
|
|
56
|
+
flexGrow: 0,
|
|
57
|
+
borderWidth: 1,
|
|
58
|
+
borderRadius: 14,
|
|
59
|
+
overflow: "hidden",
|
|
60
|
+
marginVertical: 12
|
|
61
|
+
},
|
|
62
|
+
header: {
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
justifyContent: "space-between",
|
|
66
|
+
paddingHorizontal: 12,
|
|
67
|
+
paddingVertical: 8,
|
|
68
|
+
borderBottomWidth: 1
|
|
69
|
+
},
|
|
70
|
+
lang: {
|
|
71
|
+
fontSize: 10,
|
|
72
|
+
fontWeight: "600",
|
|
73
|
+
letterSpacing: 0.6
|
|
74
|
+
},
|
|
75
|
+
code: {
|
|
76
|
+
fontFamily: Platform.OS === "ios" ? "Menlo" : "monospace",
|
|
77
|
+
fontSize: 13,
|
|
78
|
+
lineHeight: 20,
|
|
79
|
+
paddingHorizontal: 16,
|
|
80
|
+
paddingTop: 14,
|
|
81
|
+
paddingBottom: 8
|
|
82
|
+
},
|
|
83
|
+
footer: {
|
|
84
|
+
flexDirection: "row",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
paddingHorizontal: 10,
|
|
87
|
+
paddingBottom: 10
|
|
88
|
+
},
|
|
89
|
+
footerBtn: {
|
|
90
|
+
padding: 6,
|
|
91
|
+
marginRight: 4,
|
|
92
|
+
borderRadius: 6
|
|
93
|
+
}
|
|
94
|
+
});export{ChatCodeBlock};//# sourceMappingURL=ChatCodeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatCodeBlock.js","sources":["../../../src/features/chat/ChatCodeBlock.tsx"],"sourcesContent":["import React, { memo, useCallback, useEffect, useRef, useState } from 'react';\nimport { Platform, Pressable, Share, StyleSheet, View } from 'react-native';\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nimport { Clipboard } from 'react-native';\nimport { Feather } from '@expo/vector-icons';\nimport { Text } from '@admin-layout/gluestack-ui-mobile';\n\n/**\n * Same chrome as web `CodeBlockWithActions` in tailwind-chat-pro: language\n * header, wrapping monospace body, copy + share/download. Long lines wrap\n * (browser `whitespace-pre-wrap`) instead of a nested horizontal ScrollView,\n * which collapsed the card to empty height inside the transcript list.\n */\nexport const ChatCodeBlock = memo(function ChatCodeBlock({\n language,\n code,\n isDark = false,\n}: {\n language?: string;\n code: string;\n isDark?: boolean;\n}) {\n const label = ((language || 'code').trim() || 'code').toUpperCase();\n const body = code.replace(/\\n$/, '');\n const [copied, setCopied] = useState(false);\n const copiedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(\n () => () => {\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n },\n [],\n );\n\n const handleCopy = useCallback(() => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Clipboard.setString(body);\n setCopied(true);\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n copiedTimer.current = setTimeout(() => setCopied(false), 2000);\n }, [body]);\n\n const handleDownload = useCallback(() => {\n const ext =\n language === 'jsx' || language === 'tsx' ? 'tsx' : language === 'js' || language === 'ts' ? 'ts' : 'txt';\n void Share.share({ message: body, title: `snippet.${ext}` });\n }, [body, language]);\n\n const border = isDark ? 'rgba(148, 163, 184, 0.28)' : '#ebeef3';\n const headerBg = isDark ? 'rgba(148, 163, 184, 0.10)' : '#f6f7f8';\n const bodyBg = isDark ? '#171a20' : '#ffffff';\n const muted = isDark ? '#94a3b8' : '#667085';\n const ink = isDark ? '#f3f5f8' : '#121926';\n\n return (\n <View style={[styles.wrap, { borderColor: border, backgroundColor: bodyBg }]}>\n <View style={[styles.header, { backgroundColor: headerBg, borderBottomColor: border }]}>\n <Text style={[styles.lang, { color: muted }]}>{label}</Text>\n <Pressable\n onPress={handleCopy}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel={copied ? 'Copied' : 'Copy code'}\n >\n <Feather name={copied ? 'check' : 'copy'} size={14} color={copied ? '#10b981' : muted} />\n </Pressable>\n </View>\n <Text selectable style={[styles.code, { color: ink }]}>\n {body}\n </Text>\n <View style={styles.footer}>\n <Pressable\n onPress={handleCopy}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel={copied ? 'Copied' : 'Copy code'}\n style={styles.footerBtn}\n >\n <Feather name={copied ? 'check' : 'copy'} size={15} color={copied ? '#10b981' : muted} />\n </Pressable>\n <Pressable\n onPress={handleDownload}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Share code\"\n style={styles.footerBtn}\n >\n <Feather name=\"download\" size={15} color={muted} />\n </Pressable>\n </View>\n </View>\n );\n});\n\nconst styles = StyleSheet.create({\n wrap: {\n alignSelf: 'stretch',\n flexGrow: 0,\n borderWidth: 1,\n borderRadius: 14,\n overflow: 'hidden',\n marginVertical: 12,\n },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingHorizontal: 12,\n paddingVertical: 8,\n borderBottomWidth: 1,\n },\n lang: {\n fontSize: 10,\n fontWeight: '600',\n letterSpacing: 0.6,\n },\n code: {\n fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace',\n fontSize: 13,\n lineHeight: 20,\n paddingHorizontal: 16,\n paddingTop: 14,\n paddingBottom: 8,\n },\n footer: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 10,\n paddingBottom: 10,\n },\n footerBtn: {\n padding: 6,\n marginRight: 4,\n borderRadius: 6,\n },\n});\n"],"names":["ChatCodeBlock"],"mappings":"oRAaa,MAAA,aAAA,GAAgB,IAAK,CAAA,SAASA,cAAc,CAAA;AAAA,EACvD,QAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAS,GAAA;AACX,CAIG,EAAA;AACD,EAAA,MAAM,UAAU,QAAY,IAAA,MAAA,EAAQ,IAAK,EAAA,IAAK,QAAQ,WAAY,EAAA;AAClE,EAAA,MAAM,IAAO,GAAA,IAAA,CAAK,OAAQ,CAAA,KAAA,EAAO,EAAE,CAAA;AACnC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,KAAK,CAAA;AAC1C,EAAM,MAAA,WAAA,GAAc,OAA6C,IAAI,CAAA;AACrE,EAAA,SAAA,CAAU,MAAM,MAAM;AACpB,IAAA,IAAI,WAAY,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AAAA,EACA,MAAQ,EAAA;AAAA,IACN,aAAe,EAAA,KAAA;AAAA,IACf,UAAY,EAAA,QAAA;AAAA,IACZ,iBAAmB,EAAA,EAAA;AAAA,IACnB,aAAe,EAAA;AAAA,GACjB;AAAA,EACA,SAAW,EAAA;AAAA,IACT,OAAS,EAAA,CAAA;AAAA,IACT,WAAa,EAAA,CAAA;AAAA,IACb,YAAc,EAAA;AAAA;AAElB,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {jsx,Fragment,jsxs}from'react/jsx-runtime';import {useRef,useMemo,useCallback,useEffect,memo}from'react';import {View,StyleSheet,FlatList,Platform,Pressable}from'react-native';import {dismissKeyboard}from'../../utils/keyboardController.js';import {useKeyboardLiftHeight}from'../../components/KeyboardComposerDock.js';import Markdown from'react-native-markdown-display';import {shouldRenderUserTranscriptTurn,displayUserMessageText}from'../attachments/displayUserMessageText.js';import {MessageAttachmentPreviews}from'../attachments/MessageAttachmentPreviews.js';import {ToolTimeline}from'./ToolTimeline.js';import {parseToolActivity}from'./toolActivity.js';import {parseAskUser,displayAskUserAssistantText,stripAskUser}from'./askUser.js';import {collapseDuplicateUserRows,groupConsecutiveRoleRows}from'./transcriptGroups.js';import {
|
|
1
|
+
import {jsx,Fragment,jsxs}from'react/jsx-runtime';import {useRef,useMemo,useCallback,useEffect,memo}from'react';import {View,StyleSheet,FlatList,Platform,Pressable}from'react-native';import {dismissKeyboard}from'../../utils/keyboardController.js';import {useKeyboardLiftHeight}from'../../components/KeyboardComposerDock.js';import Markdown from'react-native-markdown-display';import {shouldRenderUserTranscriptTurn,displayUserMessageText}from'../attachments/displayUserMessageText.js';import {MessageAttachmentPreviews}from'../attachments/MessageAttachmentPreviews.js';import {ToolTimeline}from'./ToolTimeline.js';import {parseToolActivity}from'./toolActivity.js';import {parseAskUser,displayAskUserAssistantText,stripAskUser}from'./askUser.js';import {collapseDuplicateUserRows,groupConsecutiveRoleRows}from'./transcriptGroups.js';import {AssistantMarkdown}from'./AssistantMarkdown.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -143,7 +143,7 @@ function ChatTranscript({
|
|
|
143
143
|
const renderItem = useCallback(({
|
|
144
144
|
item
|
|
145
145
|
}) => /* @__PURE__ */ jsx(TranscriptGroupView, { group: item, isDark, renderMessageActions }), [isDark, renderMessageActions]);
|
|
146
|
-
return /* @__PURE__ */ jsx(View, { style: styles.list, children: /* @__PURE__ */ jsx(FlatList, { ref: listRef, data: groups, keyExtractor: (item) => item.id, renderItem, extraData: `${streamingContent != null ? streamingContent : ""}:${Boolean(listFooter)}`, ListFooterComponent: listFooter ? /* @__PURE__ */ jsx(Fragment, { children: listFooter }) : null, initialNumToRender: 12, maxToRenderPerBatch: 8, updateCellsBatchingPeriod: 50, windowSize:
|
|
146
|
+
return /* @__PURE__ */ jsx(View, { style: styles.list, children: /* @__PURE__ */ jsx(FlatList, { ref: listRef, data: groups, keyExtractor: (item) => item.id, renderItem, extraData: `${streamingContent != null ? streamingContent : ""}:${Boolean(listFooter)}`, ListFooterComponent: listFooter ? /* @__PURE__ */ jsx(Fragment, { children: listFooter }) : null, initialNumToRender: 12, maxToRenderPerBatch: 8, updateCellsBatchingPeriod: 50, windowSize: 21, scrollEnabled: true, nestedScrollEnabled: false, directionalLockEnabled: true, onScroll: handleScroll, onContentSizeChange: handleContentSizeChange, onLayout: () => {
|
|
147
147
|
if (stickToBottomRef.current) scrollToLatest(false);
|
|
148
148
|
}, scrollEventThrottle: 16, keyboardShouldPersistTaps: "handled", keyboardDismissMode: Platform.OS === "ios" ? "interactive" : "on-drag", automaticallyAdjustKeyboardInsets: false, automaticallyAdjustContentInsets: false, contentInsetAdjustmentBehavior: "never", contentContainerStyle: [styles.listContent, listContentStyle, !listFooter && styles.listContentFill], style: styles.list }) });
|
|
149
149
|
}
|
|
@@ -164,16 +164,12 @@ const TranscriptGroupView = memo(function TranscriptGroupView2({
|
|
|
164
164
|
] }, item.id);
|
|
165
165
|
}) });
|
|
166
166
|
}
|
|
167
|
-
const markdownColor = isDark ? "#e2e8f0" : "#111827";
|
|
168
|
-
const codeBg = isDark ? "#1e293b" : "#f3f4f6";
|
|
169
167
|
const last = group.items[group.items.length - 1];
|
|
170
|
-
return /* @__PURE__ */ jsx(View, { style: styles.assistantGroup, children: group.items.map((item, index) => /* @__PURE__ */ jsx(AssistantTurnView, { item, isDark,
|
|
168
|
+
return /* @__PURE__ */ jsx(View, { style: styles.assistantGroup, children: group.items.map((item, index) => /* @__PURE__ */ jsx(AssistantTurnView, { item, isDark, tightTop: index > 0, renderMessageActions: item.streaming || item !== last ? void 0 : renderMessageActions }, item.id)) });
|
|
171
169
|
});
|
|
172
170
|
const AssistantTurnView = memo(function AssistantTurnView2({
|
|
173
171
|
item,
|
|
174
172
|
isDark,
|
|
175
|
-
markdownColor,
|
|
176
|
-
codeBg,
|
|
177
173
|
tightTop,
|
|
178
174
|
renderMessageActions
|
|
179
175
|
}) {
|
|
@@ -182,10 +178,10 @@ const AssistantTurnView = memo(function AssistantTurnView2({
|
|
|
182
178
|
const stripped = stripAskUser(item.content);
|
|
183
179
|
const toolActivity = parseToolActivity(stripped, !!item.streaming);
|
|
184
180
|
const text = parseToolActivity(displayAskUserAssistantText(item.content, !!item.askAnswered), !!item.streaming).text;
|
|
185
|
-
return /* @__PURE__ */ jsxs(
|
|
181
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.assistantCol, tightTop && styles.assistantColTight], children: [
|
|
186
182
|
attachments.length > 0 ? /* @__PURE__ */ jsx(MessageAttachmentPreviews, { attachments, align: "start", isDark }) : null,
|
|
187
183
|
toolActivity.steps.length > 0 ? /* @__PURE__ */ jsx(ToolTimeline, { steps: toolActivity.steps, active: !!item.streaming, isDark }) : null,
|
|
188
|
-
text ? /* @__PURE__ */ jsx(
|
|
184
|
+
text ? /* @__PURE__ */ jsx(AssistantMarkdown, { text, streaming: !!item.streaming, isDark }) : null,
|
|
189
185
|
renderMessageActions ? renderMessageActions({
|
|
190
186
|
id: item.id,
|
|
191
187
|
role: "assistant",
|
|
@@ -225,90 +221,10 @@ const USER_MARKDOWN = {
|
|
|
225
221
|
color: "#ffffff"
|
|
226
222
|
}
|
|
227
223
|
};
|
|
228
|
-
function assistantMarkdownStyle(markdownColor, codeBg) {
|
|
229
|
-
return {
|
|
230
|
-
body: {
|
|
231
|
-
color: markdownColor,
|
|
232
|
-
fontSize: 15,
|
|
233
|
-
lineHeight: 22
|
|
234
|
-
},
|
|
235
|
-
heading1: {
|
|
236
|
-
fontSize: 18,
|
|
237
|
-
fontWeight: "700",
|
|
238
|
-
marginTop: 12,
|
|
239
|
-
marginBottom: 4,
|
|
240
|
-
color: markdownColor
|
|
241
|
-
},
|
|
242
|
-
heading2: {
|
|
243
|
-
fontSize: 16,
|
|
244
|
-
fontWeight: "700",
|
|
245
|
-
marginTop: 10,
|
|
246
|
-
marginBottom: 4,
|
|
247
|
-
color: markdownColor
|
|
248
|
-
},
|
|
249
|
-
heading3: {
|
|
250
|
-
fontSize: 15,
|
|
251
|
-
fontWeight: "600",
|
|
252
|
-
marginTop: 8,
|
|
253
|
-
marginBottom: 4,
|
|
254
|
-
color: markdownColor
|
|
255
|
-
},
|
|
256
|
-
strong: {
|
|
257
|
-
fontWeight: "700"
|
|
258
|
-
},
|
|
259
|
-
paragraph: {
|
|
260
|
-
marginTop: 4,
|
|
261
|
-
marginBottom: 4
|
|
262
|
-
},
|
|
263
|
-
list_item: {
|
|
264
|
-
marginVertical: 4,
|
|
265
|
-
flexDirection: "row",
|
|
266
|
-
flexWrap: "wrap"
|
|
267
|
-
},
|
|
268
|
-
bullet_list: {
|
|
269
|
-
marginVertical: 6
|
|
270
|
-
},
|
|
271
|
-
ordered_list: {
|
|
272
|
-
marginVertical: 6
|
|
273
|
-
},
|
|
274
|
-
bullet_list_icon: {
|
|
275
|
-
marginRight: 8,
|
|
276
|
-
marginTop: 2
|
|
277
|
-
},
|
|
278
|
-
ordered_list_icon: {
|
|
279
|
-
minWidth: 22,
|
|
280
|
-
marginRight: 8,
|
|
281
|
-
marginTop: 2
|
|
282
|
-
},
|
|
283
|
-
code_inline: {
|
|
284
|
-
backgroundColor: codeBg,
|
|
285
|
-
paddingHorizontal: 4,
|
|
286
|
-
borderRadius: 4,
|
|
287
|
-
fontSize: 14,
|
|
288
|
-
color: markdownColor
|
|
289
|
-
},
|
|
290
|
-
code_block: {
|
|
291
|
-
backgroundColor: codeBg,
|
|
292
|
-
padding: 12,
|
|
293
|
-
borderRadius: 8,
|
|
294
|
-
marginVertical: 8,
|
|
295
|
-
fontSize: 14,
|
|
296
|
-
color: markdownColor
|
|
297
|
-
},
|
|
298
|
-
fence: {
|
|
299
|
-
backgroundColor: codeBg,
|
|
300
|
-
padding: 12,
|
|
301
|
-
borderRadius: 8,
|
|
302
|
-
marginVertical: 8,
|
|
303
|
-
fontSize: 14,
|
|
304
|
-
color: markdownColor
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
224
|
const styles = StyleSheet.create({
|
|
309
225
|
list: {
|
|
310
226
|
flex: 1,
|
|
311
|
-
|
|
227
|
+
minHeight: 0
|
|
312
228
|
},
|
|
313
229
|
listContent: {
|
|
314
230
|
paddingTop: 8,
|
|
@@ -343,7 +259,8 @@ const styles = StyleSheet.create({
|
|
|
343
259
|
},
|
|
344
260
|
assistantCol: {
|
|
345
261
|
width: "100%",
|
|
346
|
-
|
|
262
|
+
flexGrow: 0,
|
|
263
|
+
alignItems: "stretch",
|
|
347
264
|
marginBottom: 8,
|
|
348
265
|
paddingHorizontal: 4
|
|
349
266
|
},
|