mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-05-13 07:46:47 +00:00
fix: refector the code
This commit is contained in:
parent
c6e1116ab2
commit
08650405f6
1 changed files with 4 additions and 7 deletions
|
|
@ -415,12 +415,7 @@ function isSeparatorRow(line?: string): boolean {
|
|||
}
|
||||
|
||||
function convertTableRowToTSV(row: string): string {
|
||||
const trimmed = row.trim();
|
||||
const noBoundaryPipes = trimmed.replace(/^\|/, '').replace(/\|$/, '');
|
||||
return noBoundaryPipes
|
||||
.split('|')
|
||||
.map((cell) => cell.trim())
|
||||
.join('\t');
|
||||
return parseTableCells(row).join('\t');
|
||||
}
|
||||
|
||||
function normalizeClipboardPlainText(text: string): string {
|
||||
|
|
@ -468,7 +463,9 @@ function buildClipboardHTML(markdownText: string): string {
|
|||
function parseTableCells(row: string): string[] {
|
||||
const trimmed = row.trim();
|
||||
const noBoundaryPipes = trimmed.replace(/^\|/, '').replace(/\|$/, '');
|
||||
return noBoundaryPipes.split('|').map((cell) => cell.trim());
|
||||
return noBoundaryPipes
|
||||
.split(/(?<!\\)\|/)
|
||||
.map((cell) => cell.replace(/\\\|/g, '|').trim());
|
||||
}
|
||||
|
||||
function inlineMarkdownToHTML(text: string): string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue