File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class Assistant(
5454 """
5555
5656 __author__ = "[vertyco](https://github.com/vertyco/vrt-cogs)"
57- __version__ = "6.12.19 "
57+ __version__ = "6.12.20 "
5858
5959 def format_help_for_context (self , ctx ):
6060 helpcmd = super ().format_help_for_context (ctx )
Original file line number Diff line number Diff line change @@ -405,7 +405,14 @@ async def pop(role: str) -> int:
405405 if "name" in removed :
406406 reduction += 1
407407 if content := removed .get ("content" ):
408- reduction += await self .count_tokens (content , model )
408+ if isinstance (content , list ):
409+ for i in content :
410+ if i ["type" ] == "text" :
411+ reduction += await self .count_tokens (i ["text" ], model )
412+ else :
413+ reduction += 2
414+ else :
415+ reduction += await self .count_tokens (str (content ), model )
409416 elif tool_calls := removed .get ("tool_calls" ):
410417 reduction += await self .count_tokens (str (tool_calls ), model )
411418 elif function_call := removed .get ("function_call" ):
You can’t perform that action at this time.
0 commit comments