feat(chat-frasa): acceso total a datos (13 herramientas con escopo por rol), streaming SSE, caché de embeddings, markdown y mantenimiento en Configuraciones
This commit is contained in:
@@ -131,6 +131,40 @@ export async function crearUsuarioConfig(data: {
|
||||
return (await resp.json()) as UsuarioConfig
|
||||
}
|
||||
|
||||
// ─── Asistente IA (Chat Frasa) ─────────────────────────────────
|
||||
|
||||
export interface EstadoAsistente {
|
||||
conversaciones: number
|
||||
mensajes: number
|
||||
documentos: number
|
||||
chunks: number
|
||||
ultimasPreguntas: { pregunta: string; fecha: string }[]
|
||||
}
|
||||
|
||||
/** GET /ai/estado — métricas de uso del asistente (admin) */
|
||||
export async function getEstadoAsistente(): Promise<EstadoAsistente> {
|
||||
const resp = await fetch(`${API_URL}/ai/estado`, conAuth())
|
||||
manejar401(resp)
|
||||
if (!resp.ok) throw new Error(`HTTP ${resp.status}`)
|
||||
return (await resp.json()) as EstadoAsistente
|
||||
}
|
||||
|
||||
/** POST /ai/reindexar — re-indexa la base de conocimiento del asistente (admin) */
|
||||
export async function reindexarConocimiento(): Promise<{
|
||||
documentos: number
|
||||
creados: number
|
||||
actualizados: number
|
||||
sinCambios: number
|
||||
}> {
|
||||
const resp = await fetch(`${API_URL}/ai/reindexar`, conAuth({ method: 'POST' }))
|
||||
manejar401(resp)
|
||||
if (!resp.ok) {
|
||||
const cuerpo = (await resp.json().catch(() => null)) as { error?: string } | null
|
||||
throw new Error(cuerpo?.error ?? `HTTP ${resp.status}`)
|
||||
}
|
||||
return (await resp.json()) as { documentos: number; creados: number; actualizados: number; sinCambios: number }
|
||||
}
|
||||
|
||||
// ─── Auditoría ─────────────────────────────────────────────────
|
||||
|
||||
export interface AuditoriaItem {
|
||||
|
||||
Reference in New Issue
Block a user