feat(gemini): add text handling to GeminiMultimodalLive
- Introduce text attribute in Part class for handling string data. - Incorporate text processing in GeminiMultimodalLiveLLMService to push TextFrame if text is present.
This commit is contained in:
@@ -105,6 +105,7 @@ class InlineData(BaseModel):
|
||||
|
||||
class Part(BaseModel):
|
||||
inlineData: Optional[InlineData] = None
|
||||
text: Optional[str] = None
|
||||
|
||||
|
||||
class ModelTurn(BaseModel):
|
||||
|
||||
@@ -604,6 +604,11 @@ class GeminiMultimodalLiveLLMService(LLMService):
|
||||
part = evt.serverContent.modelTurn.parts[0]
|
||||
if not part:
|
||||
return
|
||||
|
||||
text = part.text
|
||||
if text:
|
||||
await self.push_frame(TextFrame(text=text))
|
||||
|
||||
inline_data = part.inlineData
|
||||
if not inline_data:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user