Skip to content

Commit 13571ef

Browse files
authored
fix: Internationalization of Models (#2068)
1 parent f924827 commit 13571ef

File tree

81 files changed

+2242
-2199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2242
-2199
lines changed

apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from django.db.models import QuerySet
1616
from django.http import StreamingHttpResponse
17-
from django.utils.translation import gettext as __
17+
from django.utils.translation import gettext as _
1818
from langchain.chat_models.base import BaseChatModel
1919
from langchain.schema import BaseMessage
2020
from langchain.schema.messages import HumanMessage, AIMessage
@@ -174,7 +174,7 @@ def get_stream_result(message_list: List[BaseMessage],
174174
[AIMessageChunk(content=no_references_setting.get('value').replace('{question}', problem_text))]), False
175175
if chat_model is None:
176176
return iter([AIMessageChunk(
177-
__('Sorry, the AI model is not configured. Please go to the application to set up the AI model first.'))]), False
177+
_('Sorry, the AI model is not configured. Please go to the application to set up the AI model first.'))]), False
178178
else:
179179
return chat_model.stream(message_list), True
180180

@@ -219,7 +219,7 @@ def get_block_result(message_list: List[BaseMessage],
219219
return AIMessage(no_references_setting.get('value').replace('{question}', problem_text)), False
220220
if chat_model is None:
221221
return AIMessage(
222-
__('Sorry, the AI model is not configured. Please go to the application to set up the AI model first.')), False
222+
_('Sorry, the AI model is not configured. Please go to the application to set up the AI model first.')), False
223223
else:
224224
return chat_model.invoke(message_list), True
225225

apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"""
99
from typing import List
1010

11-
from django.utils.translation import gettext as __
11+
from django.utils.translation import gettext as _
1212
from langchain.schema import HumanMessage
1313

1414
from application.chat_pipeline.step.reset_problem_step.i_reset_problem_step import IResetProblemStep
1515
from application.models import ChatRecord
1616
from common.util.split_model import flat_map
1717
from setting.models_provider.tools import get_model_instance_by_model_user_id
1818

19-
prompt = __(
19+
prompt = _(
2020
"() contains the user's question. Answer the guessed user's question based on the context ({question}) Requirement: Output a complete question and put it in the <data></data> tag")
2121

2222

0 commit comments

Comments
 (0)