feat: AI context, Webhooks, Kanban drag-drop, and UI fixes
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
export const generateAIResponse = async (prompt: string, systemPrompt = 'You are a helpful assistant.') => {
|
||||
const config = useRuntimeConfig()
|
||||
const apiKey = config.deepseekApiKey || process.env.DEEPSEEK_API_KEY
|
||||
|
||||
if (!apiKey) {
|
||||
throw new Error('DEEPSEEK_API_KEY is not configured')
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await $fetch('https://api.deepseek.com/v1/chat/completions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${apiKey}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: {
|
||||
model: 'deepseek-chat',
|
||||
messages: [
|
||||
{ role: 'system', content: systemPrompt },
|
||||
{ role: 'user', content: prompt }
|
||||
],
|
||||
stream: false
|
||||
}
|
||||
}) as any
|
||||
|
||||
return response.choices[0].message.content
|
||||
} catch (error: any) {
|
||||
console.error('DeepSeek AI error:', error.data || error.message)
|
||||
throw new Error(`AI generation failed: ${error.message}`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user