@@ -40,25 +40,12 @@ function M._format_messages(session)
4040 output :add_lines (M .separator )
4141 state .current_message = msg
4242
43- if not state .current_model and msg .info .providerID and msg .info .providerID ~= ' ' then
44- state .current_model = msg .info .providerID .. ' /' .. msg .info .modelID
45- end
46-
47- if msg .info .tokens and msg .info .tokens .input > 0 then
48- state .tokens_count = msg .info .tokens .input
49- + msg .info .tokens .output
50- + msg .info .tokens .cache .read
51- + msg .info .tokens .cache .write
52- end
53-
54- if msg .info .cost and type (msg .info .cost ) == ' number' then
55- state .cost = msg .info .cost
56- end
57-
5843 if session .revert and session .revert .messageID == msg .info .id then
5944 --- @type { messages : number , tool_calls : number , files : table<string , { additions : number , deletions : number } >}
6045 local revert_stats = M ._calculate_revert_stats (state .messages , i , session .revert )
6146 M ._format_revert_message (output , revert_stats )
47+
48+ -- FIXME: how does reverting work? why is it breaking out of the message reading loop?
6249 break
6350 end
6451
@@ -69,6 +56,7 @@ function M._format_messages(session)
6956 end
7057
7158 if msg .info .error and msg .info .error ~= ' ' then
59+ vim .notify (' calling _format_error' )
7260 M ._format_error (output , msg .info )
7361 end
7462 end
@@ -788,27 +776,12 @@ end
788776--- @param msg_idx number
789777--- @return Output
790778function M .format_message_header_single (message , msg_idx )
791- local temp_output = Output .new ()
792-
793- if not state .current_model and message .info .providerID and message .info .providerID ~= ' ' then
794- state .current_model = message .info .providerID .. ' /' .. message .info .modelID
795- end
796-
797- if message .info .tokens and message .info .tokens .input > 0 then
798- state .tokens_count = message .info .tokens .input
799- + message .info .tokens .output
800- + message .info .tokens .cache .read
801- + message .info .tokens .cache .write
802- end
803-
804- if message .info .cost and type (message .info .cost ) == ' number' then
805- state .cost = message .info .cost
806- end
779+ local output = Output .new ()
807780
808- temp_output :add_lines (M .separator )
809- M ._format_message_header (temp_output , message .info , msg_idx )
781+ output :add_lines (M .separator )
782+ M ._format_message_header (output , message .info , msg_idx )
810783
811- return temp_output
784+ return output
812785end
813786
814787--- @param error_text string
0 commit comments