Skip to content

Commit b91828a

Browse files
author
liuhuiqi.7
committed
feat(e2ee): catch excpetion
1 parent 262972f commit b91828a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

volcenginesdkarkruntime/resources/chat/completions.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,12 @@ def _decrypt(
146146
choice.message is not None and choice.finish_reason != 'content_filter'
147147
and choice.message.content is not None
148148
):
149-
content = aes_gcm_decrypt_base64_string(
150-
key, nonce, choice.message.content
151-
)
149+
try:
150+
content = aes_gcm_decrypt_base64_string(
151+
key, nonce, choice.message.content
152+
)
153+
except Exception:
154+
pass
152155
if not decrypt_validate(choice.message.content):
153156
content = aes_gcm_decrypt_base64_list(
154157
key, nonce, choice.message.content
@@ -309,9 +312,12 @@ async def _decrypt(
309312
choice.message is not None and choice.finish_reason != 'content_filter'
310313
and choice.message.content is not None
311314
):
312-
content = aes_gcm_decrypt_base64_string(
313-
key, nonce, choice.message.content
314-
)
315+
try:
316+
content = aes_gcm_decrypt_base64_string(
317+
key, nonce, choice.message.content
318+
)
319+
except Exception:
320+
pass
315321
if not decrypt_validate(choice.message.content):
316322
content = aes_gcm_decrypt_base64_list(
317323
key, nonce, choice.message.content

0 commit comments

Comments
 (0)