@meistrari/chat-nuxt 3.9.1 → 3.9.2
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/dist/module.json +1 -1
- package/dist/module.mjs +56 -3
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +2 -2
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +2 -2
- package/dist/runtime/messages/message-reasoning.js +4 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -125,6 +125,35 @@ function resolveRuntimeAliases(telaBuildPath) {
|
|
|
125
125
|
return resolvedAliases;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
const QUADRATIC_GUARDS = [
|
|
129
|
+
{ from: "/[^~]*~{2,}[^~]+/", to: "/~{2,}[^~]/" },
|
|
130
|
+
{ from: "/[^*]*\\*[^*]+/", to: "/\\*[^*]/" }
|
|
131
|
+
];
|
|
132
|
+
const STREAM_MARKDOWN_PARSER_GUARD_COUNT = QUADRATIC_GUARDS.length;
|
|
133
|
+
function patchStreamMarkdownParserSource(source) {
|
|
134
|
+
let patched = source;
|
|
135
|
+
let applied = 0;
|
|
136
|
+
for (const { from, to } of QUADRATIC_GUARDS) {
|
|
137
|
+
if (!patched.includes(from)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
patched = patched.replaceAll(from, to);
|
|
141
|
+
applied++;
|
|
142
|
+
}
|
|
143
|
+
patched = patched.replace(/\n?\/\/# sourceMappingURL=.*\n?$/, "\n");
|
|
144
|
+
return { source: patched, applied };
|
|
145
|
+
}
|
|
146
|
+
function resolvePatchedStreamMarkdownParser(from) {
|
|
147
|
+
try {
|
|
148
|
+
const markstreamEntry = createRequire(from).resolve("markstream-vue");
|
|
149
|
+
const entry = createRequire(markstreamEntry).resolve("stream-markdown-parser");
|
|
150
|
+
const { source, applied } = patchStreamMarkdownParserSource(readFileSync(entry, "utf8"));
|
|
151
|
+
return { entry, source, applied };
|
|
152
|
+
} catch {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
128
157
|
const workspaceSettingsResolverCandidates = [
|
|
129
158
|
"server/chat/resolve-workspace-settings.ts",
|
|
130
159
|
"server/chat/resolve-workspace-settings.js"
|
|
@@ -347,12 +376,25 @@ const module$1 = defineNuxtModule({
|
|
|
347
376
|
nuxt.options.extends = nuxt.options.extends ? [nuxt.options.extends] : [];
|
|
348
377
|
}
|
|
349
378
|
nuxt.options.extends.unshift(telaBuildPath);
|
|
379
|
+
const patchedStreamMarkdownParser = resolvePatchedStreamMarkdownParser(import.meta.url);
|
|
380
|
+
if (patchedStreamMarkdownParser?.applied !== STREAM_MARKDOWN_PARSER_GUARD_COUNT) {
|
|
381
|
+
const cause = patchedStreamMarkdownParser ? `${patchedStreamMarkdownParser.entry}: expected ${STREAM_MARKDOWN_PARSER_GUARD_COUNT} guards, found ${patchedStreamMarkdownParser.applied}` : "not resolvable through markstream-vue";
|
|
382
|
+
console.error(
|
|
383
|
+
`[@meistrari/chat-nuxt] Could not rewrite the quadratic guards in stream-markdown-parser (${cause}). Long unbroken Markdown paragraphs will parse quadratically and can freeze the chat UI. Update QUADRATIC_GUARDS in @meistrari/chat-nuxt, or drop the rewrite if upstream fixed the backtracking.`
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
const streamMarkdownParserAlias = patchedStreamMarkdownParser?.applied === STREAM_MARKDOWN_PARSER_GUARD_COUNT ? addTemplate({
|
|
387
|
+
filename: "chat-nuxt/stream-markdown-parser.mjs",
|
|
388
|
+
write: true,
|
|
389
|
+
getContents: () => patchedStreamMarkdownParser.source
|
|
390
|
+
}).dst : void 0;
|
|
350
391
|
nuxt.options.alias = {
|
|
351
392
|
...nuxt.options.alias,
|
|
352
393
|
"#chat-auth": chatAuthTemplate.dst,
|
|
353
394
|
"#chat-workspace-settings-resolver": workspaceSettingsResolverEntry,
|
|
354
395
|
"#chat-runtime": runtimeDir,
|
|
355
|
-
"@iconify-json/ph": resolvePackageRoot("@iconify-json/ph")
|
|
396
|
+
"@iconify-json/ph": resolvePackageRoot("@iconify-json/ph"),
|
|
397
|
+
...streamMarkdownParserAlias ? { "stream-markdown-parser": streamMarkdownParserAlias } : {}
|
|
356
398
|
};
|
|
357
399
|
const importsOptions = nuxt.options.imports;
|
|
358
400
|
if (importsOptions !== false) {
|
|
@@ -404,10 +446,20 @@ const module$1 = defineNuxtModule({
|
|
|
404
446
|
});
|
|
405
447
|
}
|
|
406
448
|
nuxt.hook("vite:extendConfig", (config, { isServer }) => {
|
|
449
|
+
config.resolve = config.resolve || {};
|
|
450
|
+
if (streamMarkdownParserAlias) {
|
|
451
|
+
if (Array.isArray(config.resolve.alias)) {
|
|
452
|
+
config.resolve.alias.push({ find: "stream-markdown-parser", replacement: streamMarkdownParserAlias });
|
|
453
|
+
} else {
|
|
454
|
+
config.resolve.alias = {
|
|
455
|
+
...config.resolve.alias || {},
|
|
456
|
+
"stream-markdown-parser": streamMarkdownParserAlias
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
}
|
|
407
460
|
if (isServer) {
|
|
408
461
|
return;
|
|
409
462
|
}
|
|
410
|
-
config.resolve = config.resolve || {};
|
|
411
463
|
config.plugins = config.plugins || [];
|
|
412
464
|
if (Array.isArray(config.resolve.alias)) {
|
|
413
465
|
config.resolve.alias.push(...Object.entries(runtimeAliases).map(([find, replacement]) => ({ find, replacement })));
|
|
@@ -451,7 +503,8 @@ export default globalThis.ELK;
|
|
|
451
503
|
...nitroConfig.alias,
|
|
452
504
|
"#chat-auth": chatAuthTemplate.dst,
|
|
453
505
|
"#chat-runtime": runtimeDir,
|
|
454
|
-
"#chat-workspace-settings-resolver": workspaceSettingsResolverEntry
|
|
506
|
+
"#chat-workspace-settings-resolver": workspaceSettingsResolverEntry,
|
|
507
|
+
...streamMarkdownParserAlias ? { "stream-markdown-parser": streamMarkdownParserAlias } : {}
|
|
455
508
|
};
|
|
456
509
|
nitroConfig.publicAssets = nitroConfig.publicAssets || [];
|
|
457
510
|
nitroConfig.publicAssets.push({
|
|
@@ -63,8 +63,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
63
63
|
copyLink: () => any;
|
|
64
64
|
selectConversation: (id: string) => any;
|
|
65
65
|
cancel: () => any;
|
|
66
|
-
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
67
66
|
settings: () => any;
|
|
67
|
+
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
68
68
|
debug: () => any;
|
|
69
69
|
tabChange: (tab: TopbarTab) => any;
|
|
70
70
|
newConversation: (groupId?: string | null | undefined) => any;
|
|
@@ -84,8 +84,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
84
84
|
onCopyLink?: (() => any) | undefined;
|
|
85
85
|
onSelectConversation?: ((id: string) => any) | undefined;
|
|
86
86
|
onCancel?: (() => any) | undefined;
|
|
87
|
-
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
88
87
|
onSettings?: (() => any) | undefined;
|
|
88
|
+
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
89
89
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
90
90
|
onDebug?: (() => any) | undefined;
|
|
91
91
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
@@ -63,8 +63,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
63
63
|
copyLink: () => any;
|
|
64
64
|
selectConversation: (id: string) => any;
|
|
65
65
|
cancel: () => any;
|
|
66
|
-
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
67
66
|
settings: () => any;
|
|
67
|
+
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
68
68
|
debug: () => any;
|
|
69
69
|
tabChange: (tab: TopbarTab) => any;
|
|
70
70
|
newConversation: (groupId?: string | null | undefined) => any;
|
|
@@ -84,8 +84,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
84
84
|
onCopyLink?: (() => any) | undefined;
|
|
85
85
|
onSelectConversation?: ((id: string) => any) | undefined;
|
|
86
86
|
onCancel?: (() => any) | undefined;
|
|
87
|
-
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
88
87
|
onSettings?: (() => any) | undefined;
|
|
88
|
+
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
89
89
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
90
90
|
onDebug?: (() => any) | undefined;
|
|
91
91
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
@@ -54,6 +54,10 @@ function getParsedReasoningSteps(cache, messageId, reasoningData) {
|
|
|
54
54
|
let parsedSteps = cache.bySignature.get(cacheKey);
|
|
55
55
|
if (!parsedSteps) {
|
|
56
56
|
parsedSteps = parseReasoningFromPolling(reasoningData);
|
|
57
|
+
for (const staleKey of cache.bySignature.keys()) {
|
|
58
|
+
if (staleKey.startsWith(`${messageId}:`))
|
|
59
|
+
cache.bySignature.delete(staleKey);
|
|
60
|
+
}
|
|
57
61
|
cache.bySignature.set(cacheKey, parsedSteps);
|
|
58
62
|
}
|
|
59
63
|
cache.byReference.set(reasoningData, { messageId, parsedSteps });
|