Skip to content

Commit

Permalink
Merge pull request FlowiseAI#1717 from Jaredude/feature/chatmessage-q…
Browse files Browse the repository at this point in the history
…uery-messageId

Allows query chatmessage API endpoint by messageId
  • Loading branch information
HenryHengZJ authored Feb 13, 2024
2 parents 4e8bf49 + a6abd59 commit e2df5e9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ export class App {
const chatId = req.query?.chatId as string | undefined
const memoryType = req.query?.memoryType as string | undefined
const sessionId = req.query?.sessionId as string | undefined
const messageId = req.query?.messageId as string | undefined
const startDate = req.query?.startDate as string | undefined
const endDate = req.query?.endDate as string | undefined
let chatTypeFilter = req.query?.chatType as chatType | undefined
Expand Down Expand Up @@ -538,7 +539,8 @@ export class App {
memoryType,
sessionId,
startDate,
endDate
endDate,
messageId
)
return res.json(chatmessages)
})
Expand Down Expand Up @@ -1440,7 +1442,8 @@ export class App {
memoryType?: string,
sessionId?: string,
startDate?: string,
endDate?: string
endDate?: string,
messageId?: string
): Promise<ChatMessage[]> {
let fromDate
if (startDate) fromDate = new Date(startDate)
Expand All @@ -1455,7 +1458,8 @@ export class App {
chatId,
memoryType: memoryType ?? (chatId ? IsNull() : undefined),
sessionId: sessionId ?? undefined,
createdDate: toDate && fromDate ? Between(fromDate, toDate) : undefined
createdDate: toDate && fromDate ? Between(fromDate, toDate) : undefined,
id: messageId ?? undefined
},
order: {
createdDate: sortOrder === 'DESC' ? 'DESC' : 'ASC'
Expand Down

0 comments on commit e2df5e9

Please sign in to comment.