Skip to content

Commit b395e2e

Browse files
author
liuhuiqi.7
committed
feat(arkruntime): condition check
1 parent b08875e commit b395e2e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

volcenginesdkarkruntime/resources/batch_chat/completions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def _decrypt(
156156
if resp.choices is not None:
157157
for index, choice in enumerate(resp.choices):
158158
if (
159-
choice.finish_reason != 'content_filter' and choice.message is not None
159+
choice.message is not None and choice.finish_reason != 'content_filter'
160160
and choice.message.content is not None
161161
):
162162
choice.message.content = aes_gcm_decrypt_base64_string(
@@ -303,7 +303,7 @@ async def _decrypt(
303303
if resp.choices is not None:
304304
for index, choice in enumerate(resp.choices):
305305
if (
306-
choice.finish_reason != 'content_filter' and choice.message is not None
306+
choice.message is not None and choice.finish_reason != 'content_filter'
307307
and choice.message.content is not None
308308
):
309309
choice.message.content = aes_gcm_decrypt_base64_string(

volcenginesdkarkruntime/resources/chat/completions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def _decrypt_chunk(
108108
if chunk.choices is not None:
109109
for index, choice in enumerate(chunk.choices):
110110
if (
111-
choice.finish_reason != 'content_filter'
112-
and choice.delta is not None and choice.delta.content is not None
111+
choice.delta is not None and choice.delta.content is not None
112+
and choice.finish_reason != 'content_filter'
113113
):
114114
choice.delta.content = aes_gcm_decrypt_base64_string(
115115
key, nonce, choice.delta.content
@@ -127,7 +127,7 @@ def _decrypt(
127127
if resp.choices is not None:
128128
for index, choice in enumerate(resp.choices):
129129
if (
130-
choice.finish_reason != 'content_filter' and choice.message is not None
130+
choice.message is not None and choice.finish_reason != 'content_filter'
131131
and choice.message.content is not None
132132
):
133133
choice.message.content = aes_gcm_decrypt_base64_string(
@@ -254,8 +254,8 @@ async def _decrypt_chunk(
254254
if chunk.choices is not None:
255255
for index, choice in enumerate(chunk.choices):
256256
if (
257-
choice.finish_reason != 'content_filter'
258-
and choice.delta is not None and choice.delta.content is not None
257+
choice.delta is not None and choice.delta.content is not None
258+
and choice.finish_reason != 'content_filter'
259259
):
260260
choice.delta.content = aes_gcm_decrypt_base64_string(
261261
key, nonce, choice.delta.content
@@ -273,7 +273,7 @@ async def _decrypt(
273273
if resp.choices is not None:
274274
for index, choice in enumerate(resp.choices):
275275
if (
276-
choice.finish_reason != 'content_filter' and choice.message is not None
276+
choice.message is not None and choice.finish_reason != 'content_filter'
277277
and choice.message.content is not None
278278
):
279279
choice.message.content = aes_gcm_decrypt_base64_string(

0 commit comments

Comments
 (0)