petercat-ai / petercat

A conversational Q&A agent configuration system, self-hosted deployment solutions, and a convenient all-in-one application SDK, allowing you to create intelligent Q&A bots for your GitHub repositories
https://petercat.ai
MIT License
595 stars 16 forks source link

feat: add the i18n middleware for the server #476

Closed xingwanying closed 1 week ago

xingwanying commented 1 week ago

image

server也国际化上了

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
petercat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 8:31am
petercat-assistant[bot] commented 1 week ago

Walkthrough

该PR为服务器添加了国际化中间件,支持多语言功能。主要涉及对现有代码的调整以支持国际化,包括引入新的中间件和配置文件。

Changes

文件 概要
server/agent/tools/bot_builder.py 修改了错误信息的返回值,并调整了代码格式。
server/bot/builder.py 移除了默认的启动信息和问候信息,直接使用传入的参数。
server/bot/router.py 添加了语言参数,使用国际化工具获取默认启动信息和问候信息。
server/i18n/en.json, server/i18n/ja.json, server/i18n/ko.json, server/i18n/zh-CN.json, server/i18n/zh-TW.json 添加了新的翻译条目。
server/i18n/translations.py 新增文件,定义了国际化配置和中间件。
server/main.py 添加了国际化中间件到FastAPI应用中。
codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 41.17647% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/bot/router.py 14.28% 6 Missing :warning:
server/agent/tools/bot_builder.py 33.33% 4 Missing :warning:
Files with missing lines Coverage Δ
server/bot/builder.py 26.31% <ø> (ø)
server/main.py 92.15% <100.00%> (ø)
server/agent/tools/bot_builder.py 42.30% <33.33%> (ø)
server/bot/router.py 20.10% <14.28%> (ø)

... and 1 file with indirect coverage changes