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:
@@ -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 []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user