mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
refactor: update logging imports and enhance error messages
This commit is contained in:
parent
a59a524d1c
commit
147aa4befd
@ -5,7 +5,7 @@ import { cosineSimilarity, jaccardRank } from "./cosine";
|
||||
import { getEmbeddings } from "./embeddings";
|
||||
import { dedupImagesWithEmbeddings } from '../utils/image-tools';
|
||||
import { normalizeHostName } from '../utils/url-tools';
|
||||
import { logInfo, logError, logDebug, logWarning } from '../logging';
|
||||
import { logError, logDebug } from '../logging';
|
||||
|
||||
export async function buildReferences(
|
||||
answer: string,
|
||||
|
||||
@ -3,7 +3,7 @@ import { getKnowledgeStr } from "../utils/text-tools";
|
||||
import { getModel } from "../config";
|
||||
import { generateText } from "ai";
|
||||
import { Schemas } from "../utils/schemas";
|
||||
import { logInfo, logError, logDebug } from '../logging';
|
||||
import { logInfo, logError, logDebug, logWarning } from '../logging';
|
||||
|
||||
|
||||
function getPrompt(mdContent: string, allKnowledge: KnowledgeItem[], schema: Schemas): PromptPair {
|
||||
@ -86,7 +86,10 @@ export async function reviseAnswer(
|
||||
logDebug(`repaired before/after: ${mdContent.length} -> ${result.text.length}`);
|
||||
|
||||
if (result.text.length < mdContent.length * 0.85) {
|
||||
logError(`repaired content length ${result.text.length} is significantly shorter than original content ${mdContent.length}, return original content instead.`);
|
||||
logWarning(`repaired content length ${result.text.length} is significantly shorter than original content ${mdContent.length}, return original content instead.`, {
|
||||
originalContent: mdContent,
|
||||
repairedContent: result.text
|
||||
});
|
||||
return mdContent;
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,6 @@ axiosClient.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => {
|
||||
if (error.code === 'ECONNABORTED') {
|
||||
logError('Request timed out:', { error: error.message });
|
||||
error.request?.destroy?.();
|
||||
}
|
||||
if (axios.isAxiosError(error)) {
|
||||
|
||||
@ -430,7 +430,7 @@ export async function getLastModified(url: string): Promise<string | undefined>
|
||||
|
||||
return undefined;
|
||||
} catch (error) {
|
||||
logError('Failed to fetch last modified date:');
|
||||
logError('Failed to fetch last modified date', { error });
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user