(kb: KnowledgeBaseWithCounts)
| 44 | * Formats a KnowledgeBaseWithCounts into the API response shape. |
| 45 | */ |
| 46 | export function formatKnowledgeBase(kb: KnowledgeBaseWithCounts) { |
| 47 | return { |
| 48 | id: kb.id, |
| 49 | name: kb.name, |
| 50 | description: kb.description, |
| 51 | tokenCount: kb.tokenCount, |
| 52 | embeddingModel: kb.embeddingModel, |
| 53 | embeddingDimension: kb.embeddingDimension, |
| 54 | chunkingConfig: kb.chunkingConfig, |
| 55 | docCount: kb.docCount, |
| 56 | connectorTypes: kb.connectorTypes, |
| 57 | createdAt: serializeDate(kb.createdAt), |
| 58 | updatedAt: serializeDate(kb.updatedAt), |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Handles unexpected errors with consistent logging and response. |
no test coverage detected