File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.1.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ UNRELEASED]  
9+ 
10+ ### Bug fixes  
11+ 
12+ *  ` message_content() `  and ` message_content_chunk() `  correctly extract content from a ` chatlas.Turn ` . (#133  )
13+ 
814## [ 0.2.2]  - 2025-09-10 
915
1016### Improvements  
Original file line number Diff line number Diff line change 33import  sys 
44from  functools  import  singledispatch 
55
6- from  htmltools  import  HTML , Tagifiable ,  TagList 
6+ from  htmltools  import  HTML , Tagifiable 
77
88from  ._chat_normalize_chatlas  import  tool_request_contents , tool_result_contents 
99from  ._chat_types  import  ChatMessage 
@@ -163,10 +163,15 @@ def _(chunk: ContentToolResult):
163163
164164    @message_content .register  
165165    def  _ (message : Turn ):
166-         contents  =  TagList ()
166+         from  chatlas  import  ContentToolResult 
167+         content  =  "" 
167168        for  x  in  message .contents :
168-             contents .append (message_content (x ).content )
169-         return  ChatMessage (content = contents )
169+             content  +=  message_content (x ).content 
170+         if  all (isinstance (x , ContentToolResult ) for  x  in  message .contents ):
171+             role  =  "assistant" 
172+         else :
173+             role  =  message .role 
174+         return  ChatMessage (content = content , role = role )
170175
171176    @message_content_chunk .register  
172177    def  _ (chunk : Turn ):
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments