feat: only send user message as part of request (#957)
This commit is contained in:
parent
9279135355
commit
f18af236a0
8 changed files with 90 additions and 54 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import { generateUUID } from '@/lib/utils';
|
||||
|
||||
export const TEST_PROMPTS = {
|
||||
SKY: {
|
||||
MESSAGES: [
|
||||
{
|
||||
role: 'user',
|
||||
content: 'Why is the sky blue?',
|
||||
parts: [{ type: 'text', text: 'Why is the sky blue?' }],
|
||||
},
|
||||
],
|
||||
MESSAGE: {
|
||||
id: generateUUID(),
|
||||
createdAt: new Date().toISOString(),
|
||||
role: 'user',
|
||||
content: 'Why is the sky blue?',
|
||||
parts: [{ type: 'text', text: 'Why is the sky blue?' }],
|
||||
},
|
||||
OUTPUT_STREAM: [
|
||||
'0:"It\'s "',
|
||||
'0:"just "',
|
||||
|
|
@ -17,13 +19,14 @@ export const TEST_PROMPTS = {
|
|||
],
|
||||
},
|
||||
GRASS: {
|
||||
MESSAGES: [
|
||||
{
|
||||
role: 'user',
|
||||
content: 'Why is grass green?',
|
||||
parts: [{ type: 'text', text: 'Why is grass green?' }],
|
||||
},
|
||||
],
|
||||
MESSAGE: {
|
||||
id: generateUUID(),
|
||||
createdAt: new Date().toISOString(),
|
||||
role: 'user',
|
||||
content: 'Why is grass green?',
|
||||
parts: [{ type: 'text', text: 'Why is grass green?' }],
|
||||
},
|
||||
|
||||
OUTPUT_STREAM: [
|
||||
'0:"It\'s "',
|
||||
'0:"just "',
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ test.describe
|
|||
adaContext,
|
||||
}) => {
|
||||
const response = await adaContext.request.post('/api/chat', {
|
||||
data: {},
|
||||
data: JSON.stringify({}),
|
||||
});
|
||||
expect(response.status()).toBe(500);
|
||||
expect(response.status()).toBe(400);
|
||||
|
||||
const text = await response.text();
|
||||
expect(text).toEqual('An error occurred while processing your request!');
|
||||
expect(text).toEqual('Invalid request body');
|
||||
});
|
||||
|
||||
test('Ada can invoke chat generation', async ({ adaContext }) => {
|
||||
|
|
@ -24,7 +24,7 @@ test.describe
|
|||
const response = await adaContext.request.post('/api/chat', {
|
||||
data: {
|
||||
id: chatId,
|
||||
messages: TEST_PROMPTS.SKY.MESSAGES,
|
||||
message: TEST_PROMPTS.SKY.MESSAGE,
|
||||
selectedChatModel: 'chat-model',
|
||||
},
|
||||
});
|
||||
|
|
@ -47,7 +47,7 @@ test.describe
|
|||
const response = await babbageContext.request.post('/api/chat', {
|
||||
data: {
|
||||
id: chatId,
|
||||
messages: TEST_PROMPTS.GRASS.MESSAGES,
|
||||
message: TEST_PROMPTS.GRASS.MESSAGE,
|
||||
selectedChatModel: 'chat-model',
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue