mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
fix: broken cn chars
This commit is contained in:
parent
6d4fa95217
commit
949c34f14f
@ -959,12 +959,7 @@ But unfortunately, you failed to solve the issue. You need to think out of the b
|
||||
fixCodeBlockIndentation(
|
||||
repairMarkdownFootnotesOuter(
|
||||
await repairUnknownChars(
|
||||
await fixMarkdown(
|
||||
buildMdFromAnswer((thisStep as AnswerAction)),
|
||||
allKnowledge,
|
||||
context,
|
||||
SchemaGen
|
||||
), context))
|
||||
buildMdFromAnswer(thisStep as AnswerAction), context))
|
||||
),
|
||||
allURLs)));
|
||||
} else {
|
||||
|
||||
@ -5,7 +5,7 @@ import {TrackerContext} from "../types";
|
||||
/**
|
||||
* Repairs markdown content with <EFBFBD> characters by using Gemini to guess the missing text
|
||||
*/
|
||||
export async function repairUnknownChars(mdContent: string, trackers: TrackerContext): Promise<string> {
|
||||
export async function repairUnknownChars(mdContent: string, trackers?: TrackerContext): Promise<string> {
|
||||
if (!mdContent.includes('<27>')) return mdContent;
|
||||
|
||||
let repairedContent = mdContent;
|
||||
@ -68,7 +68,7 @@ On the right of the stains: "${rightContext}"
|
||||
So what was the original text between these two contexts?`,
|
||||
});
|
||||
|
||||
trackers.tokenTracker.trackUsage('md-fixer', result.usage)
|
||||
trackers?.tokenTracker.trackUsage('md-fixer', result.usage)
|
||||
const replacement = result.text.trim();
|
||||
|
||||
// Validate the replacement
|
||||
|
||||
@ -717,6 +717,10 @@ export function repairMarkdownFinal(markdown: string): string {
|
||||
try {
|
||||
let repairedMarkdown = markdown;
|
||||
|
||||
// remove any '<27>'
|
||||
repairedMarkdown = repairedMarkdown.replace(/<2F>/g, '');
|
||||
|
||||
|
||||
// Step 1: Handle <hr> and <br> tags outside tables
|
||||
|
||||
// First, identify table regions to exclude them from the replacement
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user