mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
Add additional debug logs. Also fix build warning about environment variables
This commit is contained in:
parent
3c581bd72e
commit
36ae7cfe52
3 changed files with 15 additions and 7 deletions
|
|
@ -243,7 +243,7 @@ const chatHandler = ({ messages, id, selectedRepos, languageModelId }: ChatHandl
|
|||
stream,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error("Error:", error)
|
||||
logger.error(error)
|
||||
logger.error("Error stack:", error instanceof Error ? error.stack : "No stack trace")
|
||||
Sentry.captureException(error);
|
||||
|
||||
|
|
@ -409,6 +409,8 @@ const getAISDKLanguageModelAndOptions = async (config: LanguageModel, orgId: num
|
|||
}
|
||||
|
||||
const errorHandler = (error: unknown) => {
|
||||
logger.error(error);
|
||||
|
||||
if (error == null) {
|
||||
return 'unknown error';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@ export const createAgentStream = async ({
|
|||
langfuseTraceId: traceId,
|
||||
},
|
||||
},
|
||||
onError: (error) => {
|
||||
logger.error(error);
|
||||
},
|
||||
});
|
||||
|
||||
return stream;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,19 @@
|
|||
import * as Sentry from '@sentry/nextjs';
|
||||
import { registerOTel } from '@vercel/otel';
|
||||
import { LangfuseExporter } from 'langfuse-vercel';
|
||||
import { env } from './env.mjs';
|
||||
|
||||
export async function register() {
|
||||
if (env.LANGFUSE_SECRET_KEY && env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY) {
|
||||
if (
|
||||
process.env.LANGFUSE_SECRET_KEY &&
|
||||
process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
|
||||
) {
|
||||
console.log("Registering Langfuse");
|
||||
registerOTel({
|
||||
serviceName: 'sourcebot',
|
||||
traceExporter: new LangfuseExporter({
|
||||
secretKey: env.LANGFUSE_SECRET_KEY,
|
||||
publicKey: env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY,
|
||||
baseUrl: env.NEXT_PUBLIC_LANGFUSE_BASE_URL,
|
||||
secretKey: process.env.LANGFUSE_SECRET_KEY,
|
||||
publicKey: process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY,
|
||||
baseUrl: process.env.NEXT_PUBLIC_LANGFUSE_BASE_URL,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
|
@ -24,7 +27,7 @@ export async function register() {
|
|||
}
|
||||
|
||||
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
||||
await import ('./initialize');
|
||||
await import('./initialize');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue