Thanks for your excellent job! I used gradio.ChatInterface to build a llm web rebot, I want to yield from two variables in the chat function, but when the second generator output, the first generotor content is gone, only the second generator content show in the chatbot UI.
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
def chat(self, message: str, history: List[List[str]]) -> Iterator[str]:
for human, assistant in history:
self.messages.append({"role": "user", "content": human})
self.messages.append({"role": "assistant", "content": assistant})
self.messages.append({"role": "user", "content": self.rag(message)})
responses = dashscope.Generation.call(model=self.llm_info['Model'],
api_key=self.llm_info['Key'],
messages=self.messages,
result_format='message',
stream=True)
for response in responses:
response_content = response.output.choices[0]['message']['content']
yield response_content
for i, title in enumerate(self.refer_titles, 1):
refer_title = f'[{i}] {title}'
yield refer_title
Screenshot
No response
Logs
No response
System Info
Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.37.2
gradio_client version: 1.0.2
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.111.0
ffmpy: 0.3.2
gradio-client==1.0.2 is not installed.
httpx: 0.26.0
huggingface-hub: 0.22.2
importlib-resources: 6.4.0
jinja2: 3.1.2
markupsafe: 2.1.1
matplotlib: 3.7.0
numpy: 1.23.5
orjson: 3.10.1
packaging: 23.2
pandas: 1.5.3
pillow: 9.4.0
pydantic: 2.8.2
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.5.1
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.9.0
urllib3: 1.26.19
uvicorn: 0.22.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2024.3.1
httpx: 0.26.0
huggingface-hub: 0.22.2
packaging: 23.2
typing-extensions: 4.9.0
websockets: 11.0.3
Describe the bug
Thanks for your excellent job! I used gradio.ChatInterface to build a llm web rebot, I want to yield from two variables in the chat function, but when the second generator output, the first generotor content is gone, only the second generator content show in the chatbot UI.
Have you searched existing issues? 🔎
Reproduction
Screenshot
No response
Logs
No response
System Info
Severity
I can work around it