Skip to content

Commit f2caedb

Browse files
committed
fixed api error when exceeding 4096 characters
1 parent 09cd922 commit f2caedb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/services/aiService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ FULL MEETING CONVERSATION:
7777
${context.fullConversation || 'No conversation available'}${aiConversationsText}
7878
7979
INSTRUCTIONS:
80-
1. Be concise and helpful - keep responses under ~200 words
80+
1. Be concise and helpful - keep responses under ~200 words. You should NEVER exceed 4096 characters.
8181
2. Use the meeting context and full conversation history to provide relevant insights
8282
3. If asked about specific topics, provide thoughtful analysis based on the context
8383
4. Be professional but friendly in tone

src/services/recallService.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,17 @@ class RecallService {
114114

115115
async sendChatMessage(botId, message, recipient = 'everyone') {
116116
try {
117+
// Recall.ai has a 4096 character limit for chat messages
118+
const MAX_MESSAGE_LENGTH = 4096;
119+
let processedMessage = message;
120+
121+
if (message.length > MAX_MESSAGE_LENGTH) {
122+
logger.logWarn(`Message too long (${message.length} chars), truncating to ${MAX_MESSAGE_LENGTH} chars`);
123+
processedMessage = message.substring(0, MAX_MESSAGE_LENGTH - 20) + '... [message truncated]';
124+
}
125+
117126
const messageData = {
118-
message: message,
127+
message: processedMessage,
119128
to: recipient
120129
};
121130

0 commit comments

Comments
 (0)