File tree Expand file tree Collapse file tree 1 file changed +2
-22
lines changed
Expand file tree Collapse file tree 1 file changed +2
-22
lines changed Original file line number Diff line number Diff line change @@ -13,27 +13,6 @@ const CheckDiscussion = 'Check if the question is related to discussion.';
1313export class AiService {
1414 constructor ( private knex : Knex , private bot : TelegramBot , private mcpClient : Client ) { }
1515
16- private sessionExists = async ( session : string ) : Promise < boolean > => {
17- const response = await this . mcpClient . callTool ( {
18- name : "session_exists" ,
19- arguments : { session }
20- } ) ;
21-
22- return ( response . content as any ) [ 0 ] . text !== 'false' ;
23- } ;
24-
25- private createMcpSession = async ( session : string ) : Promise < void > => {
26- const exists = await this . sessionExists ( session ) ;
27- if ( exists ) return ;
28- await this . mcpClient . callTool ( {
29- name : "create_session" ,
30- arguments : {
31- session,
32- flexible : true ,
33- }
34- } ) ;
35- }
36-
3716 private clearMcpSession = async ( session : string ) : Promise < void > => {
3817 await this . mcpClient . callTool ( {
3918 name : "clear_session" ,
@@ -110,7 +89,8 @@ export class AiService {
11089 if ( reply === 'yes' || reply === 'no' ) {
11190 return reply === 'yes' ;
11291 } else {
113- throw new Error ( `Unexpected response from Gemini (boolean): ${ reply } . Expected 'yes' or 'no'.` ) ;
92+ console . error ( `Unexpected response from Gemini (boolean): ${ reply } . Expected 'yes' or 'no'.` ) ;
93+ return true ; // Default to true if unexpected response
11494 }
11595 } ;
11696
You can’t perform that action at this time.
0 commit comments