mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
fix(llm): fix logging type check
This commit is contained in:
parent
41906abaf9
commit
e96fdbf72f
@ -335,7 +335,7 @@ export async function processProviderStream(
|
|||||||
chunkCount++;
|
chunkCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
chunkCount++;
|
chunkCount++;
|
||||||
finalChunk = chunk;
|
finalChunk = chunk;
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ export async function processProviderStream(
|
|||||||
// For chunks with content, send the content directly
|
// For chunks with content, send the content directly
|
||||||
const contentProperty = getChunkContentProperty(chunk);
|
const contentProperty = getChunkContentProperty(chunk);
|
||||||
const hasRealContent = contentProperty && contentProperty.trim().length > 0;
|
const hasRealContent = contentProperty && contentProperty.trim().length > 0;
|
||||||
|
|
||||||
if (hasRealContent) {
|
if (hasRealContent) {
|
||||||
await StreamProcessor.sendChunkToCallback(
|
await StreamProcessor.sendChunkToCallback(
|
||||||
streamCallback,
|
streamCallback,
|
||||||
@ -429,7 +429,7 @@ export async function processProviderStream(
|
|||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Improved error handling to preserve original error even if logging fails
|
// Improved error handling to preserve original error even if logging fails
|
||||||
let logError = null;
|
let logError: unknown | null = null;
|
||||||
try {
|
try {
|
||||||
log.error(`Error in ${options.providerName} stream processing: ${error instanceof Error ? error.message : String(error)}`);
|
log.error(`Error in ${options.providerName} stream processing: ${error instanceof Error ? error.message : String(error)}`);
|
||||||
log.error(`Error details: ${error instanceof Error ? error.stack : 'No stack trace available'}`);
|
log.error(`Error details: ${error instanceof Error ? error.stack : 'No stack trace available'}`);
|
||||||
@ -437,7 +437,7 @@ export async function processProviderStream(
|
|||||||
// Store logging error but don't let it override the original error
|
// Store logging error but don't let it override the original error
|
||||||
logError = loggingError;
|
logError = loggingError;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always throw the original error, not the logging error
|
// Always throw the original error, not the logging error
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user