Build fixes: offline-safe fonts, Next.js API route type updates, TS strict errors resolved, MUI import cleanup, chat markdown wrapper, Azure OpenAI typing, caching key + chapter API id types, and misc error-logging typings.

This commit is contained in:
andupetcu
2025-09-22 17:07:31 +03:00
parent c82b3007fd
commit 98c17d69bc
26 changed files with 106 additions and 105 deletions

View File

@@ -1,4 +1,5 @@
import { AzureOpenAI } from 'openai'
import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions'
const client = new AzureOpenAI({
apiKey: process.env.AZURE_OPENAI_KEY!,
@@ -7,7 +8,7 @@ const client = new AzureOpenAI({
})
export async function generateChatResponse(
messages: Array<{ role: string; content: string }>,
messages: Array<{ role: 'user' | 'assistant'; content: string }>,
verseContext?: string
) {
try {
@@ -17,7 +18,7 @@ export async function generateChatResponse(
model: process.env.AZURE_OPENAI_DEPLOYMENT || 'gpt-4',
messages: [
{ role: 'system', content: systemPrompt },
...messages
...messages as unknown as ChatCompletionMessageParam[]
],
temperature: 0.7,
max_tokens: 1000
@@ -56,4 +57,4 @@ export async function generateEmbedding(text: string): Promise<number[]> {
// Return empty array if embedding service is not available
return []
}
}
}