(args: {
req: Request;
node: AIRouterAttemptNode;
payload: Record<string, unknown>;
})
| 1518 | } |
| 1519 | |
| 1520 | export function createAIRouterAttemptRequest(args: { |
| 1521 | req: Request; |
| 1522 | node: AIRouterAttemptNode; |
| 1523 | payload: Record<string, unknown>; |
| 1524 | }): AIRouterAttemptRequestContext { |
| 1525 | const attemptReq = Object.create(args.req) as Request & |
| 1526 | AIGatewayLogAwareRequest; |
| 1527 | let capturedGatewayLogId: string | undefined; |
| 1528 | |
| 1529 | attemptReq.params = { |
| 1530 | ...args.req.params, |
| 1531 | gatewayId: args.node.gatewayId, |
| 1532 | }; |
| 1533 | attemptReq.body = args.payload; |
| 1534 | attemptReq.__aiGatewayLogPromise = undefined; |
| 1535 | attemptReq.__onAIGatewayLogCreated = (log) => { |
| 1536 | capturedGatewayLogId = log.id; |
| 1537 | }; |
| 1538 | |
| 1539 | return { |
| 1540 | attemptReq, |
| 1541 | getGatewayLogId: () => |
| 1542 | getBufferedAIGatewayLogId(attemptReq, capturedGatewayLogId), |
| 1543 | }; |
| 1544 | } |
| 1545 | |
| 1546 | export function buildBufferedAIGatewayAttemptResult(args: { |
| 1547 | protocol?: AIRouterProtocol; |
no test coverage detected