feat: integrate OCI agent streaming and web voice client
This commit is contained in:
@@ -10,7 +10,6 @@ from __future__ import annotations
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from collections.abc import AsyncIterator
|
||||
from contextlib import aclosing
|
||||
@@ -19,6 +18,7 @@ import oci
|
||||
|
||||
from voice_assistant.agent.adapter import AgentAdapter
|
||||
from voice_assistant.agent.oci_stream import stream_sse_events
|
||||
from voice_assistant.agent.oci_connection import open_oci_stream
|
||||
|
||||
|
||||
def extract_text_delta(raw_data: str) -> str | None:
|
||||
@@ -205,9 +205,8 @@ class OCIAgentAdapter(AgentAdapter):
|
||||
self.model_id,
|
||||
)
|
||||
|
||||
response = await asyncio.to_thread(
|
||||
self.client.chat,
|
||||
details,
|
||||
response = await open_oci_stream(
|
||||
lambda: self.client.chat(details)
|
||||
)
|
||||
|
||||
if response.status != 200:
|
||||
@@ -256,4 +255,3 @@ class OCIAgentAdapter(AgentAdapter):
|
||||
)
|
||||
|
||||
return response_text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user