Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/controllers/hivemind.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import HivemindTemporalService from '../services/temporal/hivemind.service';
import { catchAsync } from '../utils';

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

Expand Down
4 changes: 3 additions & 1 deletion src/services/temporal/hivemind.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface HivemindPayload {
community_id: string;
query: string;
enable_answer_skipping: boolean;
chat_id: string;
}

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

// // Construct the payload as specified
const payload: HivemindPayload = {
community_id: communityId,
query: query,
enable_answer_skipping: enableAnswerSkipping,
chat_id: chatId,
};
try {
const hivemindTaskQueue = 'HIVEMIND_AGENT_QUEUE';
Expand Down