-
Notifications
You must be signed in to change notification settings - Fork 12
Add README translation #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
async def translate_readme_request_async( | ||
self, readme_content: str, target_language: str, semaphore: asyncio.Semaphore | ||
) -> dict: | ||
"""Asynchronous request to translate README content via LLM.""" | ||
prompt = PromptBuilder(self.config_loader).get_prompt_translate_readme(readme_content, target_language) | ||
async with semaphore: | ||
response = await self.model_handler.async_request(prompt) | ||
response = process_text(response) | ||
try: | ||
result = json.loads(response) | ||
except json.JSONDecodeError: | ||
logger.warning(f"LLM response for '{target_language}' is not valid JSON, applying fallback") | ||
result = { | ||
"content": response.strip(), | ||
"suffix": target_language[:2].lower(), | ||
} | ||
|
||
result["target_language"] = target_language | ||
return result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А нет смысла всю эту асинхронную логику куда-то отдельно вынести и при необходимости переиспользовать? Она же вроде не специфична именно для translate-функциоальности?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, в будущем надо будет перенести. Скорее всего в модуль с генерацией readme
Пока не стабильно переводятся названия секций README + В разработке добавление переведенных README на страницу github.
Примеры для https://github.com/Roman223/GAN_MFS
README_de.md
README_ru.md
README_zh.md