Skip to content

Commit

Permalink
update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
LiChengxin007 committed Jan 13, 2024
1 parent ffff434 commit 499646a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ai/backend/aidb/aidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ async def check_api_key(self):
return True
except HTTPError as http_err:
traceback.print_exc()
error_miss_key = self.generate_error_message(http_err, error_message=self.error_miss_key)

error_miss_key = self.generate_error_message(http_err, error_message=LanguageInfo.api_key_fail)
await self.put_message(500, CONFIG.talker_log, CONFIG.type_log_data, error_miss_key)
return False
except Exception as e:
Expand All @@ -296,8 +297,7 @@ async def test_api_key(self):
try:
ApiKey, HttpProxyHost, HttpProxyPort, ApiHost = self.load_api_key(token_path)
if ApiKey is None or len(ApiKey) == 0:
await self.put_message(500, CONFIG.talker_log, CONFIG.type_log_data, self.error_miss_key)
return False
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, LanguageInfo.no_api_key)

self.agent_instance_util.set_api_key(ApiKey, ApiHost)

Expand Down
8 changes: 4 additions & 4 deletions ai/backend/language_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def load_info_cn(self):
self.error_no_report_question = "非常抱歉,本对话只处理报表生成类问题,这个问题请您到数据分析对话中提问"

self.no_api_key = '未检测到apikey,请核查'
self.api_key_success = '检测通过~'
self.api_key_fail = '检测未通过~'
self.api_key_success = 'API Key 检测通过~'
self.api_key_fail = 'API Key 检测未通过~'

def load_info_en(self):
self.question_ask = ' This is my question,Answer user questions in English: '
Expand All @@ -34,7 +34,7 @@ def load_info_en(self):
self.error_no_report_question = 'Sorry, this conversation only deals with report generation issues. Please ask this question in the data analysis conversation.'

self.no_api_key = 'apikey not detected, please check'
self.api_key_success = 'Test Success~'
self.api_key_fail = 'Test Fail~'
self.api_key_success = 'API Key Test Success~'
self.api_key_fail = 'API Key Test Fail~'

LanguageInfo = LanguageInfo()

0 comments on commit 499646a

Please sign in to comment.