This commit is contained in:
Jeremy Yin 2024-03-14 19:21:49 +08:00
parent fc4856c249
commit 0769004ebb
1 changed files with 2 additions and 2 deletions

View File

@ -8,11 +8,11 @@ from simplylab.providers import Providers
class ChatService: class ChatService:
def __init__(self, ctx: Any): def __init__(self, ctx: Any):
self.ctx = ctx self.ctx = ctx
self.pvd = Providers()
async def get_ai_chat_response(self, req: GetAiChatResponseInput) -> GetAiChatResponseOutput: async def get_ai_chat_response(self, req: GetAiChatResponseInput) -> GetAiChatResponseOutput:
pvd = Providers()
message = req.message message = req.message
response_content = await pvd.openrouter.chat(content=message) response_content = await self.pvd.openrouter.chat(content=message)
res = GetAiChatResponseOutput(response=response_content) res = GetAiChatResponseOutput(response=response_content)
return res return res