Skip to content

An AI-powered search engine with a generative UI

feat: add RELATED_QUESTION_MODEL env var support

Yoshiki Miurad8cc7b9c45b4
diff --git a/lib/streaming/create-chat-stream-response.ts b/lib/streaming/create-chat-stream-response.ts
index c028cc05..521d6306 100644
--- a/lib/streaming/create-chat-stream-response.ts
+++ b/lib/streaming/create-chat-stream-response.ts
@@ -45,7 +45,6 @@ export async function createChatStreamResponse(
isNewChat,
searchMode
} = config
- const modelId = `${model.providerId}:${model.id}`
// Verify that chatId is provided
if (!chatId) {
diff --git a/lib/streaming/helpers/handle-stream-finish.ts b/lib/streaming/helpers/handle-stream-finish.ts
index 8624cf93..cda5d898 100644
--- a/lib/streaming/helpers/handle-stream-finish.ts
+++ b/lib/streaming/helpers/handle-stream-finish.ts
@@ -40,8 +40,11 @@ export async function handleStreamFinish(
data: { status: 'loading' }
})
+ // Use RELATED_QUESTION_MODEL env var if set, otherwise use the main model
+ const questionModel = process.env.RELATED_QUESTION_MODEL || modelId
+
const relatedQuestions = await generateRelatedQuestions(
- modelId,
+ questionModel,
[...messagesToModel, responseMessage],
abortSignal,
parentTraceId