mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 01:01:11 +03:00
return JSON output in the chat
This commit is contained in:
@@ -152,13 +152,15 @@ export class CustomChainHandler extends BaseCallbackHandler {
|
||||
skipK = 0 // Skip streaming for first K numbers of handleLLMStart
|
||||
returnSourceDocuments = false
|
||||
cachedResponse = true
|
||||
isOutputParser = false
|
||||
|
||||
constructor(socketIO: Server, socketIOClientId: string, skipK?: number, returnSourceDocuments?: boolean) {
|
||||
constructor(socketIO: Server, socketIOClientId: string, skipK?: number, returnSourceDocuments?: boolean, isOutputParser?: boolean) {
|
||||
super()
|
||||
this.socketIO = socketIO
|
||||
this.socketIOClientId = socketIOClientId
|
||||
this.skipK = skipK ?? this.skipK
|
||||
this.returnSourceDocuments = returnSourceDocuments ?? this.returnSourceDocuments
|
||||
this.isOutputParser = isOutputParser ?? this.isOutputParser
|
||||
}
|
||||
|
||||
handleLLMStart() {
|
||||
@@ -171,6 +173,7 @@ export class CustomChainHandler extends BaseCallbackHandler {
|
||||
if (!this.isLLMStarted) {
|
||||
this.isLLMStarted = true
|
||||
this.socketIO.to(this.socketIOClientId).emit('start', token)
|
||||
if (this.isOutputParser) this.socketIO.to(this.socketIOClientId).emit('token', '```json')
|
||||
}
|
||||
this.socketIO.to(this.socketIOClientId).emit('token', token)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user