mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-22 19:58:51 +00:00
fix(ai): prevent marked parse error from crashing chat during streaming
This commit is contained in:
@@ -858,7 +858,11 @@ const markedInstance = new Marked({
|
||||
});
|
||||
|
||||
function formatInlineText(text: string): string {
|
||||
return markedInstance.parse(text) as string;
|
||||
try {
|
||||
return markedInstance.parse(text) as string;
|
||||
} catch {
|
||||
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
}
|
||||
}
|
||||
|
||||
const messageRenderer = computed(() => {
|
||||
|
||||
@@ -4024,12 +4024,6 @@ const canvasEditingCell = computed(() => {
|
||||
return { rowIndex, visibleColIdx, actualColIdx: editing.col, rect };
|
||||
});
|
||||
|
||||
const canvasSingleSelectedCell = computed(() => {
|
||||
const range = selectedRange.value;
|
||||
if (!range || range.startRow !== range.endRow || range.startCol !== range.endCol) return null;
|
||||
return { rowIndex: range.startRow, visibleColIdx: range.startCol };
|
||||
});
|
||||
|
||||
function canvasEffectiveViewportWidth(): number {
|
||||
return canvasViewportWidth.value || canvasScrollerElement()?.clientWidth || 0;
|
||||
}
|
||||
@@ -6335,7 +6329,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
|
||||
<div v-if="whereSuggestions.length > 0" class="fixed z-50 min-w-[180px] rounded-md border bg-popover text-popover-foreground shadow-md" :style="whereSuggestionStyle">
|
||||
<div
|
||||
v-for="(sug, idx) in whereSuggestions"
|
||||
:key="`${sug.kind}:${sug.value}`"
|
||||
:key="`${sug.kind}:${sug.value}`"
|
||||
class="flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer"
|
||||
:class="idx === whereSuggestionIndex ? 'bg-accent text-accent-foreground' : 'hover:bg-gray-200 dark:hover:bg-gray-800'"
|
||||
@mousedown.prevent="
|
||||
|
||||
Reference in New Issue
Block a user