processors(rtvi): use send a type=response as command responses
This commit is contained in:
@@ -86,12 +86,16 @@ class RTVIMessage(BaseModel):
|
|||||||
data: Optional[RTVIMessageData] = None
|
data: Optional[RTVIMessageData] = None
|
||||||
|
|
||||||
|
|
||||||
class RTVIBasicResponse(BaseModel):
|
class RTVIResponseData(BaseModel):
|
||||||
label: Literal["realtime-ai"] = "realtime-ai"
|
|
||||||
type: str
|
type: str
|
||||||
success: bool
|
success: bool
|
||||||
error: Optional[str] = None
|
error: Optional[str] = None
|
||||||
|
|
||||||
|
class RTVIResponse(BaseModel):
|
||||||
|
label: Literal["realtime-ai"] = "realtime-ai"
|
||||||
|
type: Literal["response"] = "response"
|
||||||
|
data: RTVIResponseData
|
||||||
|
|
||||||
|
|
||||||
class RTVILLMContextMessageData(BaseModel):
|
class RTVILLMContextMessageData(BaseModel):
|
||||||
messages: List[dict]
|
messages: List[dict]
|
||||||
@@ -363,6 +367,6 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
if parent and self._start_frame:
|
if parent and self._start_frame:
|
||||||
parent.link(pipeline)
|
parent.link(pipeline)
|
||||||
|
|
||||||
message = RTVIBasicResponse(type=type, success=success, error=error)
|
message = RTVIResponse(data=RTVIResponseData(type=type, success=success, error=error))
|
||||||
frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))
|
frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
|
|||||||
Reference in New Issue
Block a user