Improve Chinese language support in AutoGPT / 希望能优化中文使用体验,现在的中文使用体验很差
Duplicates
- [X] I have searched the existing issues
Summary 💡
No response
Examples 🌈
No response
Motivation 🔦
No response
frontend文件夹,是不是连中文显示都是乱码
你能举些例子吗?截图?复制细节?我知道体验不是很好,但不知道如何复制环境来开始修复它。
尝试过很多方式,sqlite入库时候检查 utf-8编码,api 入参、出参检查uft-8编码,flutter for web项目额外引入字体库显示,都没有解决显示 中文乱码问题。不知道有没有方案帮助我
我有几个想法。我认为渲染可能发生在Flutter中。SQLite数据库中的中文是否正确?我们可以开始缩小问题位置。
你有什么技能和兴趣来解决这个问题?
我们团队中没有人母语是中文,所以在不知道如何使用中文电脑的情况下调试会有些困难。任何指示都将有所帮助。
另外,请原谅我,我正在使用 GPT-4 进行翻译。如果有任何不清楚的地方,请告诉我。
SQLite数据库中的中文是否正确
你有安装Flutter调试工具吗?
flutter工具显示,如果是写在页面上的中文,显示没有问题;但是如果是接口返回的数组中含有的中文,显示为乱码。所以问题出在响应头中没有设置编码utf-8。从响应头的截图上也能说明这点,
现在发现问题出现在response上,解决方案如下:
1、agent_protocol_server.py,增加一个函数:
def create_middleware(app: FastAPI):
async def add_custom_header(request: Request, call_next: Callable) -> Response:
response = await call_next(request)
response.headers["Content-Type"] = "application/json ; charset=UTF-8"
return response
app.middleware("http")(add_custom_header)
2、调用这个函数在FastAPI 实例化后,如下:
最后中文能够正常显示:
If there's continued demand for this on the new platform let's track that in #7206
Please let me know!