Changes getMessage date logic from Between to >= and <= to fix issue if invalid startDate is passed in

also cleans up imports from typeorm lib
This commit is contained in:
Jared Tracy
2024-02-13 11:11:53 -06:00
parent 6de1e8acec
commit 4d7c7d6ef5
+3 -2
View File
@@ -10,7 +10,7 @@ import logger from './utils/logger'
import { expressRequestLogger } from './utils/logger'
import { v4 as uuidv4 } from 'uuid'
import OpenAI from 'openai'
import { Between, IsNull, FindOptionsWhere } from 'typeorm'
import { FindOptionsWhere, MoreThanOrEqual, LessThanOrEqual } from 'typeorm'
import {
IChatFlow,
IncomingInput,
@@ -1464,7 +1464,8 @@ export class App {
chatId,
memoryType: memoryType ?? undefined,
sessionId: sessionId ?? undefined,
createdDate: toDate && fromDate ? Between(fromDate, toDate) : undefined
...(fromDate && { createdDate: MoreThanOrEqual(fromDate) }),
...(toDate && { createdDate: LessThanOrEqual(toDate) })
},
order: {
createdDate: sortOrder === 'DESC' ? 'DESC' : 'ASC'