mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-14 00:53:25 +00:00
feat: configuration
This commit is contained in:
@ -9,16 +9,18 @@ from .tesou import Tesou
|
||||
from .fastchat import Fastchat
|
||||
from .g2e import G2E
|
||||
from .text_and_image import TextAndImage
|
||||
from injector import Injector
|
||||
|
||||
class BlackboxFactory:
|
||||
|
||||
def __init__(self) -> None:
|
||||
injector = Injector()
|
||||
self.tts = TTS()
|
||||
self.asr = ASR(".env.yaml")
|
||||
self.sentiment = Sentiment()
|
||||
self.audio_to_text = AudioToText()
|
||||
self.text_to_audio = TextToAudio()
|
||||
self.tesou = Tesou()
|
||||
self.tesou = injector.get(Tesou)
|
||||
self.fastchat = Fastchat()
|
||||
self.audio_chat = AudioChat(self.asr, self.tesou, self.tts)
|
||||
self.g2e = G2E()
|
||||
|
||||
@ -2,11 +2,18 @@ from typing import Any, Coroutine
|
||||
|
||||
from fastapi import Request, Response, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from injector import inject
|
||||
from ..configuration import TesouConf
|
||||
from .blackbox import Blackbox
|
||||
|
||||
import requests
|
||||
|
||||
class Tesou(Blackbox):
|
||||
url: str
|
||||
|
||||
@inject
|
||||
def __init__(self, tesou_config: TesouConf):
|
||||
self.url = tesou_config.url
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.processing(*args, **kwargs)
|
||||
@ -17,12 +24,11 @@ class Tesou(Blackbox):
|
||||
|
||||
# 用户输入的数据格式为:[{"id": "123", "prompt": "叉烧饭,帮我查询叉烧饭的介绍"}]
|
||||
def processing(self, id, prompt) -> str:
|
||||
url = 'http://120.196.116.194:48891/chat/'
|
||||
message = {
|
||||
"user_id": id,
|
||||
"prompt": prompt,
|
||||
}
|
||||
response = requests.post(url, json=message)
|
||||
response = requests.post(self.url, json=message)
|
||||
return response.json()
|
||||
|
||||
async def fast_api_handler(self, request: Request) -> Response:
|
||||
|
||||
Reference in New Issue
Block a user