trading_agent.terminal.widgets.turn_view
¶
One turn in the chat: what woke the desk, its steps, the text it is writing, and its answer.
The steps of a turn are only ever added at the end, and only the last tool run grows, so the view updates its step views by position and mounts views for new ones.
Typical usage example:
view = TurnView(turn) view.show(turn)
TurnView
¶
Bases: Vertical
A turn's view.
Attributes:
| Name | Type | Description |
|---|---|---|
trigger_id |
The trigger the turn belongs to. |
Creates the view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk the turn belongs to, for its pictures. |
required |
turn
|
ChatTurn
|
The turn. |
required |
Source code in src/trading_agent/terminal/widgets/turn_view.py
compose
¶
Builds the view's parts.
Yields:
| Type | Description |
|---|---|
Widget
|
The heading, message, steps, writing, answer (as Markdown, or as plain text for a /command's reply), error and status. |
Source code in src/trading_agent/terminal/widgets/turn_view.py
on_mount
¶
show
¶
Updates the view from the turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
turn
|
ChatTurn
|
The turn, perhaps with more steps, text or an answer. |
required |
Source code in src/trading_agent/terminal/widgets/turn_view.py
expand_tools
¶
Opens or folds every tool run of the turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expanded
|
bool
|
True to open, False to fold. |
required |