Skip to content

Commit e65b52a

Browse files
committed
add chat id
1 parent 82e6e12 commit e65b52a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/controllers/hivemind.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import HivemindTemporalService from '../services/temporal/hivemind.service';
66
import { catchAsync } from '../utils';
77

88
const askQuestion = catchAsync(async function (req: IAuthRequest, res: Response) {
9-
console.debug('Body', req.body.communityId, req.body.question);
9+
console.debug('Body', req.body.communityId, req.body.question, req.body.chatId);
1010
req.setTimeout(6 * 60 * 1000);
1111
res.setTimeout(6 * 60 * 1000);
12-
const answer = await HivemindTemporalService.triggerWorkflow(req.body.communityId, req.body.question, false);
12+
const answer = await HivemindTemporalService.triggerWorkflow(req.body.communityId, req.body.question, false, req.body.chatId);
1313
res.status(httpStatus.OK).send({ answer });
1414
});
1515

src/services/temporal/hivemind.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface HivemindPayload {
99
community_id: string;
1010
query: string;
1111
enable_answer_skipping: boolean;
12+
chat_id: string;
1213
}
1314

1415
class HivemindTemporalService extends TemporalCoreService {
@@ -24,14 +25,15 @@ class HivemindTemporalService extends TemporalCoreService {
2425
* @param enableAnswerSkipping - Flag indicating if answer skipping is enabled.
2526
* @returns The workflow ID of the started workflow.
2627
*/
27-
public async triggerWorkflow(communityId: string, query: string, enableAnswerSkipping: boolean) {
28+
public async triggerWorkflow(communityId: string, query: string, enableAnswerSkipping: boolean, chatId: string = '') {
2829
const client: Client = await this.getClient();
2930

3031
// // Construct the payload as specified
3132
const payload: HivemindPayload = {
3233
community_id: communityId,
3334
query: query,
3435
enable_answer_skipping: enableAnswerSkipping,
36+
chat_id: chatId,
3537
};
3638
try {
3739
const hivemindTaskQueue = 'HIVEMIND_AGENT_QUEUE';

0 commit comments

Comments
 (0)