feat: add tests for /api/chat (#950)

This commit is contained in:
Jeremy 2025-04-22 18:55:17 -07:00 committed by GitHub
parent 4ca93aaf89
commit a159b77fcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 197 additions and 50 deletions

36
tests/prompts/routes.ts Normal file
View file

@ -0,0 +1,36 @@
export const TEST_PROMPTS = {
SKY: {
MESSAGES: [
{
role: 'user',
content: 'Why is the sky blue?',
parts: [{ type: 'text', text: 'Why is the sky blue?' }],
},
],
OUTPUT_STREAM: [
'0:"It\'s "',
'0:"just "',
'0:"blue "',
'0:"duh! "',
'e:{"finishReason":"stop","usage":{"promptTokens":3,"completionTokens":10},"isContinued":false}',
'd:{"finishReason":"stop","usage":{"promptTokens":3,"completionTokens":10}}',
],
},
GRASS: {
MESSAGES: [
{
role: 'user',
content: 'Why is grass green?',
parts: [{ type: 'text', text: 'Why is grass green?' }],
},
],
OUTPUT_STREAM: [
'0:"It\'s "',
'0:"just "',
'0:"green "',
'0:"duh! "',
'e:{"finishReason":"stop","usage":{"promptTokens":3,"completionTokens":10},"isContinued":false}',
'd:{"finishReason":"stop","usage":{"promptTokens":3,"completionTokens":10}}',
],
},
};