fix: Shorten image data in message copies for better debugging; update logging to reflect changes

This commit is contained in:
Showdown76 2025-05-19 13:17:51 +02:00
parent 0af7dc7699
commit 892f41f78a

View File

@ -69,8 +69,19 @@ class AIProcessor:
# Make sure the two last messages from user has an image, but set disable_image to True for the others # Make sure the two last messages from user has an image, but set disable_image to True for the others
for msg in self.session.messages[:-2]: for msg in self.session.messages[:-2]:
msg.image = None msg.image = None
# copy of self.session.messages, but shorten the image data for better debugging
cps = [
aic.Message(
role=msg.role,
content=msg.content,
image=msg.image[:20] if isinstance(msg.image, str) else None, # type: ignore
disable_image=True,
name=msg.name,
)
for msg in self.session.messages
]
logger.debug( logger.debug(
self.session.messages "Shortened message copies for processing: %s", cps
) )
if reexec: if reexec:
self.session.messages.append( self.session.messages.append(
@ -84,7 +95,7 @@ class AIProcessor:
ai.compute.take_screenshot() ai.compute.take_screenshot()
) )
outputs.extend( x for x in self.process(nextsteps, img) ) outputs.extend( self.process(nextsteps, img) )
return [ return [
{ {
"name": tc.function.name, "name": tc.function.name,