@@ -160,6 +160,7 @@ export default {
160160 },
161161 ] as LLMMessageContentPart [],
162162 outputStreamRole: Role .Bot ,
163+ runningAskingConsumption: {} as HistoryEntryConsumption ,
163164 error: null as { title: string ; message: string } | null ,
164165 userScroll: false ,
165166 minimized: false ,
@@ -201,7 +202,9 @@ export default {
201202 return result
202203 },
203204 totalChatConsumption(): HistoryEntryConsumption | null {
204- let result = {} as HistoryEntryConsumption
205+ let result = {
206+ ... this .runningAskingConsumption
207+ } as HistoryEntryConsumption
205208
206209 for (let msg of this .chatHistory ) {
207210 if (msg .Consumption === undefined ){
@@ -298,6 +301,7 @@ export default {
298301 this .progress = true
299302 this .error = null
300303 this .userScroll = false
304+ this .runningAskingConsumption = {}
301305
302306 const setInput = () => {
303307 this .pushHistory ({
@@ -353,6 +357,7 @@ export default {
353357 } finally {
354358 this .progress = false
355359 this .outputStream [0 ].Content = ' '
360+ this .runningAskingConsumption = {}
356361 }
357362 },
358363 async onSubmit(input : ChatInputType ) {
@@ -393,6 +398,9 @@ export default {
393398 EventsOn (' llm:message:update' , (message : LLMMessage ) => {
394399 this .updateHistoryMessage (message )
395400 })
401+ EventsOn (' llm:consumption:update' , (consumption : HistoryEntryConsumption ) => {
402+ this .runningAskingConsumption = consumption
403+ })
396404 EventsOn (' system:restart' , () => {
397405 // backend requested a restart
398406 // so we have to save the current state and restart the app
0 commit comments