(ctx context.Context, traceID, requestID string, req types.AIRequest, now time.Time)
| 433 | } |
| 434 | |
| 435 | func (s *Server) createLedgerRequest(ctx context.Context, traceID, requestID string, req types.AIRequest, now time.Time) { |
| 436 | if s.ledger == nil { |
| 437 | return |
| 438 | } |
| 439 | in, _ := json.Marshal(req.Input) |
| 440 | ctxb, _ := json.Marshal(req.Context) |
| 441 | full, _ := json.Marshal(req) |
| 442 | _ = s.ledger.CreateRequest(ctx, requests.RequestRow{ |
| 443 | RequestID: requestID, |
| 444 | TraceID: traceID, |
| 445 | RequestType: req.RequestType, |
| 446 | TenantID: req.TenantID, |
| 447 | TaskType: req.TaskType, |
| 448 | Priority: req.Priority, |
| 449 | PipelineRef: req.PipelineRef, |
| 450 | InputJSON: in, |
| 451 | ContextJSON: ctxb, |
| 452 | AIRequestJSON: full, |
| 453 | Status: "running", |
| 454 | CreatedAt: now, |
| 455 | UpdatedAt: now, |
| 456 | }) |
| 457 | } |
| 458 | |
| 459 | func (s *Server) updateLedgerFailed(ctx context.Context, requestID string) { |
| 460 | if s.ledger == nil { |
no test coverage detected