22 lines
754 B
TypeScript
22 lines
754 B
TypeScript
// src/pages/api/ai/embeddings-status.ts
|
|
import type { APIRoute } from 'astro';
|
|
import { embeddingsService } from '../../../utils/embeddings.js';
|
|
import { apiResponse, apiServerError } from '../../../utils/api.js';
|
|
|
|
export const prerender = false;
|
|
|
|
export const GET: APIRoute = async () => {
|
|
try {
|
|
const stats = embeddingsService.getStats();
|
|
|
|
return apiResponse.success({
|
|
embeddings: stats,
|
|
timestamp: new Date().toISOString(),
|
|
status: stats.enabled && stats.initialized ? 'ready' :
|
|
stats.enabled && !stats.initialized ? 'initializing' : 'disabled'
|
|
});
|
|
} catch (error) {
|
|
console.error('Embeddings status error:', error);
|
|
return apiServerError.internal('Failed to get embeddings status');
|
|
}
|
|
}; |