mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +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,
|
stream,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Error:", error)
|
logger.error(error)
|
||||||
logger.error("Error stack:", error instanceof Error ? error.stack : "No stack trace")
|
logger.error("Error stack:", error instanceof Error ? error.stack : "No stack trace")
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
|
|
||||||
|
|
@ -409,6 +409,8 @@ const getAISDKLanguageModelAndOptions = async (config: LanguageModel, orgId: num
|
||||||
}
|
}
|
||||||
|
|
||||||
const errorHandler = (error: unknown) => {
|
const errorHandler = (error: unknown) => {
|
||||||
|
logger.error(error);
|
||||||
|
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
return 'unknown error';
|
return 'unknown error';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,9 @@ export const createAgentStream = async ({
|
||||||
langfuseTraceId: traceId,
|
langfuseTraceId: traceId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
logger.error(error);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
import * as Sentry from '@sentry/nextjs';
|
import * as Sentry from '@sentry/nextjs';
|
||||||
import { registerOTel } from '@vercel/otel';
|
import { registerOTel } from '@vercel/otel';
|
||||||
import { LangfuseExporter } from 'langfuse-vercel';
|
import { LangfuseExporter } from 'langfuse-vercel';
|
||||||
import { env } from './env.mjs';
|
|
||||||
|
|
||||||
export async function register() {
|
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({
|
registerOTel({
|
||||||
serviceName: 'sourcebot',
|
serviceName: 'sourcebot',
|
||||||
traceExporter: new LangfuseExporter({
|
traceExporter: new LangfuseExporter({
|
||||||
secretKey: env.LANGFUSE_SECRET_KEY,
|
secretKey: process.env.LANGFUSE_SECRET_KEY,
|
||||||
publicKey: env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY,
|
publicKey: process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY,
|
||||||
baseUrl: env.NEXT_PUBLIC_LANGFUSE_BASE_URL,
|
baseUrl: process.env.NEXT_PUBLIC_LANGFUSE_BASE_URL,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue