mirror of
https://github.com/aljazceru/enclava.git
synced 2025-12-18 07:54:29 +01:00
fixing prompt template view
This commit is contained in:
@@ -237,8 +237,26 @@ export function ChatbotManager() {
|
||||
const loadPromptTemplates = async () => {
|
||||
try {
|
||||
const templates = await apiClient.get('/api-internal/v1/prompt-templates/templates')
|
||||
setPromptTemplates(templates)
|
||||
|
||||
// If no templates exist, seed the defaults
|
||||
if (templates.length === 0) {
|
||||
try {
|
||||
await apiClient.post('/api-internal/v1/prompt-templates/seed-defaults', {})
|
||||
// Reload templates after seeding
|
||||
const newTemplates = await apiClient.get('/api-internal/v1/prompt-templates/templates')
|
||||
setPromptTemplates(newTemplates)
|
||||
toast({
|
||||
title: "Templates Initialized",
|
||||
description: "Default prompt templates have been created"
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Failed to seed default templates:', error)
|
||||
}
|
||||
} else {
|
||||
setPromptTemplates(templates)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load prompt templates:', error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user