fix(telegram-bot): context window issue
This commit is contained in:
@@ -26,7 +26,7 @@ export async function readMessage(
|
||||
}> {
|
||||
const logger = useLogg('readMessage').useGlobalConfig()
|
||||
|
||||
const lastNMessages = await findLastNMessages(action.chatId, 10)
|
||||
const lastNMessages = await findLastNMessages(action.chatId, 100)
|
||||
const lastNMessagesOneliner = lastNMessages.map(msg => chatMessageToOneLine(botId, msg)).join('\n')
|
||||
logger.withField('number_of_last_n_messages', lastNMessages.length).log('Successfully found last N messages')
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ export async function findLastNMessages(chatId: string, n: number) {
|
||||
|
||||
export async function findRelevantMessages(botId: string, chatId: string, unreadHistoryMessagesEmbedding: { embedding: number[] }[], excludeMessageIds: string[] = []) {
|
||||
const db = useDrizzle()
|
||||
const contextWindowSize = 2 // Number of messages to include before and after
|
||||
const contextWindowSize = 10 // Number of messages to include before and after
|
||||
const logger = useLogg('findRelevantMessages').useGlobalConfig().withField('chatId', chatId)
|
||||
|
||||
logger.withField('context_window_size', contextWindowSize).log('Querying relevant chat messages...')
|
||||
|
||||
Reference in New Issue
Block a user