mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
addLineForCmd should only increment for running commands. also openai lines should increment
This commit is contained in:
parent
c5d4a0e1f3
commit
7e0722275b
@ -2858,10 +2858,13 @@ func OpenAICommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus
|
||||
if promptStr == "" {
|
||||
return nil, fmt.Errorf("openai error, prompt string is blank")
|
||||
}
|
||||
update := scbus.MakeUpdatePacket()
|
||||
sstore.IncrementNumRunningCmds_Update(update, cmd.ScreenId, 1)
|
||||
line, err := sstore.AddOpenAILine(ctx, ids.ScreenId, DefaultUserId, cmd)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot add new line: %v", err)
|
||||
}
|
||||
|
||||
if resolveBool(pk.Kwargs["stream"], true) {
|
||||
go doOpenAIStreamCompletion(cmd, clientData.ClientId, opts, prompt)
|
||||
} else {
|
||||
@ -2876,7 +2879,6 @@ func OpenAICommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus
|
||||
// ignore error again (nothing to do)
|
||||
log.Printf("openai error updating screen selected line: %v\n", err)
|
||||
}
|
||||
update := scbus.MakeUpdatePacket()
|
||||
sstore.AddLineUpdate(update, line, cmd)
|
||||
update.AddUpdate(*screen)
|
||||
return update, nil
|
||||
@ -3011,7 +3013,9 @@ func addLineForCmd(ctx context.Context, metaCmd string, shouldFocus bool, ids re
|
||||
update := scbus.MakeUpdatePacket()
|
||||
sstore.AddLineUpdate(update, rtnLine, cmd)
|
||||
update.AddUpdate(*screen)
|
||||
if cmd.Status == sstore.CmdStatusRunning {
|
||||
sstore.IncrementNumRunningCmds_Update(update, cmd.ScreenId, 1)
|
||||
}
|
||||
updateHistoryContext(ctx, rtnLine, cmd, cmd.FeState)
|
||||
return update, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user