Skip to content

Commit

Permalink
feat(pm2.json):add
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoskys committed Dec 23, 2023
1 parent 55c7c29 commit ce2b7f4
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions llmkira/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# @Author : sudoskys
# @File : error.py
# @Software: PyCharm
# 更安全的 format
import random


class ReplyNeededError(Exception):
Expand All @@ -15,10 +17,6 @@ def __init__(self, message: str = None, *args):
super().__init__(message, *args)


# 更安全的 format
import random


class MappingDefault(dict):
def __missing__(self, key):
return key
Expand Down Expand Up @@ -61,9 +59,7 @@ def __missing__(self, key):

def get_request_error_message(error: str):
_txt: str = random.choice(REQUEST_ERROR_MESSAGE_TEMPLATE)
return _txt.format_map(
MappingDefault(error=error)
)
return _txt.format_map(MappingDefault(error=error))


# 同样贴心的上传错误提示 (ノ>ω<)ノ
Expand All @@ -78,12 +74,10 @@ def get_request_error_message(error: str):
"OMG, {filename} ,ERROR UPLOAD, `{error}`",
"WTF, I CANT UPLOAD {filename} BECAUSE `{error}`",
"MY PHONE IS BROKEN, I CANT UPLOAD {filename} BECAUSE `{error}`",
"As a human, I can't upload {filename} for you :( \n `{error}`"
"As a human, I can't upload {filename} for you :( \n `{error}`",
]


def get_upload_error_message(filename: str, error: str):
_txt: str = random.choice(REQUEST_ERROR_MESSAGE_TEMPLATE)
return _txt.format_map(
MappingDefault(filename=filename, error=error)
)
return _txt.format_map(MappingDefault(filename=filename, error=error))

0 comments on commit ce2b7f4

Please sign in to comment.