| 140 | } |
| 141 | |
| 142 | func (r *UiRuntime) MountStateSnapshot(state *agent.AgentState) { |
| 143 | r.CurrentState = state |
| 144 | r.Frame = NewRenderFrame() |
| 145 | r.Frame.TranscriptEntries = TranscriptEntriesFromState(state) |
| 146 | r.Frame.InputEnabled = true |
| 147 | r.Frame.InputMode = "normal" |
| 148 | r.Frame.InputPlaceholder = "请输入消息并回车。" |
| 149 | r.refreshContextWindowFrame() |
| 150 | if preparer, ok := r.UI.(RuntimePreparer); ok { |
| 151 | preparer.PrepareRuntime() |
| 152 | } |
| 153 | if r.UI != nil { |
| 154 | r.UI.Mount(r.Frame) |
| 155 | r.Mounted = true |
| 156 | } |
| 157 | r.Dirty = false |
| 158 | } |
| 159 | |
| 160 | func TranscriptEntriesFromState(state *agent.AgentState) []map[string]any { |
| 161 | if state == nil { |