some fixes
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import io
|
import io
|
||||||
import json
|
|
||||||
from google import genai
|
from google import genai
|
||||||
from google.genai import types
|
from google.genai import types
|
||||||
from pydub import AudioSegment
|
from pydub import AudioSegment
|
||||||
@@ -23,8 +22,6 @@ class TTSAgent:
|
|||||||
frame_rate=24000,
|
frame_rate=24000,
|
||||||
channels=1
|
channels=1
|
||||||
)
|
)
|
||||||
|
|
||||||
# Экспортируем как .ogg с кодеком opus
|
|
||||||
ogg_io = io.BytesIO()
|
ogg_io = io.BytesIO()
|
||||||
audio.export(ogg_io, format="ogg", codec="libopus")
|
audio.export(ogg_io, format="ogg", codec="libopus")
|
||||||
ogg_bytes = ogg_io.getvalue()
|
ogg_bytes = ogg_io.getvalue()
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ import json
|
|||||||
from google import genai
|
from google import genai
|
||||||
from .structures import InputMessage, OutputMessage
|
from .structures import InputMessage, OutputMessage
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from .content_config import CONTENT_CONFIG
|
from .content_configs import MAIN_CONTENT_CONFIG
|
||||||
|
|
||||||
class SolarisClient:
|
class SolarisClient:
|
||||||
def __init__(self, api_key: str) -> None:
|
def __init__(self, api_key: str) -> None:
|
||||||
client = genai.Client(api_key=api_key).aio
|
client = genai.Client(api_key=api_key).aio
|
||||||
self.chat = client.chats.create(
|
self.chat = client.chats.create(
|
||||||
model="gemini-2.5-flash",
|
model="gemini-2.5-flash",
|
||||||
config=CONTENT_CONFIG
|
config=MAIN_CONTENT_CONFIG
|
||||||
)
|
)
|
||||||
|
#self.tts
|
||||||
async def send_messages(self, messages: list[InputMessage]) -> list[OutputMessage]:
|
async def send_messages(self, messages: list[InputMessage]) -> list[OutputMessage]:
|
||||||
data = json.dumps(
|
data = json.dumps(
|
||||||
[msg.model_dump() for msg in messages],
|
[msg.model_dump() for msg in messages],
|
||||||
|
|||||||
Reference in New Issue
Block a user