Skip to content

Commit 59a5047

Browse files
committed
check for missing messages
1 parent fc08535 commit 59a5047

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/actions/createChatMessage.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ Here is a description of the user's models. Assume these are the only models ava
6666
module.exports = async function createChatMessage(params) {
6767
const { authorization, modelDescriptions, messages, model } = new CreateChatMessageParams(params);
6868

69+
if (!messages) {
70+
throw new Error('Missing messages');
71+
}
72+
6973
const db = await connect();
7074
const { AccessToken, RateLimit } = db.models;
7175

src/actions/summarizeChatThread.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ const SummarizeChatThreadParams = new Archetype({
1919

2020
const systemPrompt = 'Summarize the following chat thread in 6 words or less, as a helpful thread title';
2121

22-
module.exports = async function createChatMessage(params) {
22+
module.exports = async function summarizeChatThread(params) {
2323
const { authorization, messages } = new SummarizeChatThreadParams(params);
24+
if (!messages) {
25+
throw new Error('Missing messages');
26+
}
2427

2528
const db = await connect();
2629
const { AccessToken, RateLimit } = db.models;

0 commit comments

Comments
 (0)