|
@@ -894,19 +894,15 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Get embeddings count
|
|
|
|
|
- const embeddings = this.db.getShopContent(shop.id);
|
|
|
|
|
|
|
+ // Get actual embedding statistics
|
|
|
|
|
+ const embeddingStats = this.db.getShopEmbeddingsStats(shop.id);
|
|
|
|
|
|
|
|
res.json({
|
|
res.json({
|
|
|
data: {
|
|
data: {
|
|
|
enabled: shop.qdrant_enabled || false,
|
|
enabled: shop.qdrant_enabled || false,
|
|
|
custom_id: shop.custom_id,
|
|
custom_id: shop.custom_id,
|
|
|
collections: [], // Would need to implement collection listing
|
|
collections: [], // Would need to implement collection listing
|
|
|
- embedding_stats: {
|
|
|
|
|
- total_embeddings: embeddings.length,
|
|
|
|
|
- completed: embeddings.filter(e => e.embedding_status === 'completed').length,
|
|
|
|
|
- failed: embeddings.filter(e => e.embedding_status === 'failed').length
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ embedding_stats: embeddingStats
|
|
|
},
|
|
},
|
|
|
success: true
|
|
success: true
|
|
|
});
|
|
});
|
|
@@ -1130,53 +1126,26 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
// Prepare batch of content items to sync
|
|
// Prepare batch of content items to sync
|
|
|
const embeddingBatch: any[] = [];
|
|
const embeddingBatch: any[] = [];
|
|
|
|
|
|
|
|
- // Process all content types
|
|
|
|
|
- for (const content of latestContent.shipping) {
|
|
|
|
|
- embeddingBatch.push({
|
|
|
|
|
- contentId: content.id,
|
|
|
|
|
- contentType: 'shipping' as const,
|
|
|
|
|
- url: content.url,
|
|
|
|
|
- content: content.content,
|
|
|
|
|
- title: content.title,
|
|
|
|
|
- contentHash: content.content_hash,
|
|
|
|
|
- contentChanged: true // Force re-sync
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (const content of latestContent.contacts) {
|
|
|
|
|
- embeddingBatch.push({
|
|
|
|
|
- contentId: content.id,
|
|
|
|
|
- contentType: 'contacts' as const,
|
|
|
|
|
- url: content.url,
|
|
|
|
|
- content: content.content,
|
|
|
|
|
- title: content.title,
|
|
|
|
|
- contentHash: content.content_hash,
|
|
|
|
|
- contentChanged: true
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (const content of latestContent.terms) {
|
|
|
|
|
- embeddingBatch.push({
|
|
|
|
|
- contentId: content.id,
|
|
|
|
|
- contentType: 'terms' as const,
|
|
|
|
|
- url: content.url,
|
|
|
|
|
- content: content.content,
|
|
|
|
|
- title: content.title,
|
|
|
|
|
- contentHash: content.content_hash,
|
|
|
|
|
- contentChanged: true
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (const content of latestContent.faq) {
|
|
|
|
|
- embeddingBatch.push({
|
|
|
|
|
- contentId: content.id,
|
|
|
|
|
- contentType: 'faq' as const,
|
|
|
|
|
- url: content.url,
|
|
|
|
|
- content: content.content,
|
|
|
|
|
- title: content.title,
|
|
|
|
|
- contentHash: content.content_hash,
|
|
|
|
|
- contentChanged: true
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // Process all content types using array iteration to avoid duplication
|
|
|
|
|
+ const contentTypes: Array<{ type: 'shipping' | 'contacts' | 'terms' | 'faq', items: any[] }> = [
|
|
|
|
|
+ { type: 'shipping', items: latestContent.shipping },
|
|
|
|
|
+ { type: 'contacts', items: latestContent.contacts },
|
|
|
|
|
+ { type: 'terms', items: latestContent.terms },
|
|
|
|
|
+ { type: 'faq', items: latestContent.faq }
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ for (const { type, items } of contentTypes) {
|
|
|
|
|
+ for (const content of items) {
|
|
|
|
|
+ embeddingBatch.push({
|
|
|
|
|
+ contentId: content.id,
|
|
|
|
|
+ contentType: type,
|
|
|
|
|
+ url: content.url,
|
|
|
|
|
+ content: content.content,
|
|
|
|
|
+ title: content.title,
|
|
|
|
|
+ contentHash: content.content_hash,
|
|
|
|
|
+ contentChanged: true // Force re-sync
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (embeddingBatch.length === 0) {
|
|
if (embeddingBatch.length === 0) {
|