(
stage: "request" | "response" | "error",
endpoint: AIEndpoint,
extras: AIEndpointDebugExtras = {},
)
| 28 | } |
| 29 | |
| 30 | export function logAIEndpointDebug( |
| 31 | stage: "request" | "response" | "error", |
| 32 | endpoint: AIEndpoint, |
| 33 | extras: AIEndpointDebugExtras = {}, |
| 34 | ): void { |
| 35 | const payload = { |
| 36 | action: extras.action || "", |
| 37 | endpointId: endpoint.id, |
| 38 | endpointName: endpoint.name, |
| 39 | provider: endpoint.provider, |
| 40 | useExactRequestUrl: endpoint.useExactRequestUrl, |
| 41 | hasApiKey: Boolean(endpoint.apiKey), |
| 42 | method: extras.method || "", |
| 43 | model: extras.model || "", |
| 44 | status: extras.status, |
| 45 | statusText: extras.statusText, |
| 46 | contentType: extras.contentType, |
| 47 | responseLength: extras.responseLength, |
| 48 | responseBodyPreview: extras.responseBodyPreview || "", |
| 49 | modelCount: extras.modelCount, |
| 50 | }; |
| 51 | |
| 52 | console.log(`[AIEndpoint][${stage}]`, JSON.stringify(payload)); |
| 53 | } |
no outgoing calls
no test coverage detected