MCPcopy Index your code
hub / github.com/coder/coder / TestChatDebugRunDetail

Function TestChatDebugRunDetail

coderd/database/db2sdk/db2sdk_test.go:486–573  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

484}
485
486func TestChatDebugRunDetail(t *testing.T) {
487 t.Parallel()
488
489 startedAt := time.Now().UTC().Round(time.Second)
490 finishedAt := startedAt.Add(5 * time.Second)
491 rootChatID := uuid.New()
492 parentChatID := uuid.New()
493 modelConfigID := uuid.New()
494 triggerMessageID := int64(7)
495 historyTipMessageID := int64(11)
496
497 run := database.ChatDebugRun{
498 ID: uuid.New(),
499 ChatID: uuid.New(),
500 RootChatID: uuid.NullUUID{UUID: rootChatID, Valid: true},
501 ParentChatID: uuid.NullUUID{UUID: parentChatID, Valid: true},
502 ModelConfigID: uuid.NullUUID{UUID: modelConfigID, Valid: true},
503 TriggerMessageID: sql.NullInt64{Int64: triggerMessageID, Valid: true},
504 HistoryTipMessageID: sql.NullInt64{Int64: historyTipMessageID, Valid: true},
505 Kind: "chat_turn",
506 Status: "completed",
507 Provider: sql.NullString{String: "openai", Valid: true},
508 Model: sql.NullString{String: "gpt-4o", Valid: true},
509 Summary: json.RawMessage(`{"step_count":2}`),
510 StartedAt: startedAt,
511 UpdatedAt: finishedAt,
512 FinishedAt: sql.NullTime{Time: finishedAt, Valid: true},
513 }
514 steps := []database.ChatDebugStep{
515 {
516 ID: uuid.New(),
517 RunID: run.ID,
518 ChatID: run.ChatID,
519 StepNumber: 1,
520 Operation: "stream",
521 Status: "completed",
522 NormalizedRequest: json.RawMessage(`{"messages":[]}`),
523 Attempts: json.RawMessage(`[]`),
524 Metadata: json.RawMessage(`{}`),
525 StartedAt: startedAt,
526 UpdatedAt: finishedAt,
527 },
528 {
529 ID: uuid.New(),
530 RunID: run.ID,
531 ChatID: run.ChatID,
532 StepNumber: 2,
533 Operation: "generate",
534 Status: "completed",
535 NormalizedRequest: json.RawMessage(`{"messages":[]}`),
536 Attempts: json.RawMessage(`[]`),
537 Metadata: json.RawMessage(`{}`),
538 StartedAt: startedAt,
539 UpdatedAt: finishedAt,
540 },
541 }
542
543 sdk := db2sdk.ChatDebugRunDetail(run, steps)

Callers

nothing calls this directly

Calls 5

ChatDebugRunDetailFunction · 0.92
AddMethod · 0.65
NewMethod · 0.65
EqualMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected