Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions cozeloop/decorator/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ def sync_wrapper(*args: Any, **kwargs: Any):
span.set_tags(tags)
span.finish()

if res:
return res
return res

@wraps(func)
async def async_wrapper(*args: Any, **kwargs: Any):
Expand Down Expand Up @@ -140,8 +139,7 @@ async def async_wrapper(*args: Any, **kwargs: Any):
span.set_tags(tags)
span.finish()

if res:
return res
return res

@wraps(func)
def gen_wrapper(*args: Any, **kwargs: Any):
Expand Down Expand Up @@ -249,7 +247,7 @@ def sync_stream_wrapper(*args: Any, **kwargs: Any):
span.set_input(input)
span.set_tags(tags)

if not hasattr(res, "__iter__") and res:
if not hasattr(res, "__iter__"):
return res

@wraps(func)
Expand Down Expand Up @@ -288,7 +286,7 @@ async def async_stream_wrapper(*args: Any, **kwargs: Any):
span.set_input(input)
span.set_tags(tags)

if not hasattr(res, "__aiter__") and res:
if not hasattr(res, "__aiter__"):
return res

if is_async_gen_func(func):
Expand Down Expand Up @@ -449,7 +447,7 @@ async def __async_streamer__(
self.__span.set_start_time_first_resp(time.time_ns() // 1_000)
self.__is_set_start_time_first_token = True
yield s
except StopIteration:
except (StopIteration, StopAsyncIteration):
pass


Expand Down
2 changes: 1 addition & 1 deletion cozeloop/internal/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
# SPDX-License-Identifier: MIT

VERSION = 'v0.1.21'
VERSION = 'v0.1.22'
Empty file added tests/decorator/__init__.py
Empty file.
Loading