File size: 561 Bytes
6ee47c4
163e91e
 
6ee47c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from model.chat import *
import sys
import os

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))

class Controller:
    def __init__(self) -> None:
        self.chat_dic = {}
        self.rag_handler = RAG()

    def handle_message(self,
                       chat_id: int,
                       message: str) -> str:
        if chat_id not in self.chat_dic:
             self.chat_dic[chat_id] = Chat(chat_id=chat_id, rag_handler=self.rag_handler)
        chat = self.chat_dic[chat_id]
        return chat.response(message)