Skip to content

Commit 899f7db

Browse files
naming, improving display
1 parent c1d32f4 commit 899f7db

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

src/ai-bundle/src/Profiler/DataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function lateCollect(): void
6969
];
7070
}
7171

72-
public function collectChatCall(string $method, float $duration, mixed $input, mixed $result, ?\Throwable $error): void
72+
public function collectAgentCall(string $method, float $duration, mixed $input, mixed $result, ?\Throwable $error): void
7373
{
7474
$this->collectedChatCalls[] = [
7575
'method' => $method,
@@ -112,7 +112,7 @@ public function getToolCalls(): array
112112
/**
113113
* @return list<array{method: string, duration: float, input: mixed, result: mixed, error: ?\Throwable}>
114114
*/
115-
public function getChatCalls(): array
115+
public function getAgentCalls(): array
116116
{
117117
if (!isset($this->data['chat_calls'])) {
118118
return [];

src/ai-bundle/src/Profiler/TraceableAgent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function call(MessageBag $messages, array $options = []): ResultInterface
3636
$error = $e;
3737
throw $e;
3838
} finally {
39-
$this->collector->collectChatCall(
39+
$this->collector->collectAgentCall(
4040
'call',
4141
microtime(true) - $startTime,
4242
$messages,

src/ai-bundle/templates/data_collector.html.twig

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
22

3+
{% block head %}
4+
{{ parent() }}
5+
<style>
6+
.profiler-content table.table pre {
7+
white-space: pre-wrap;
8+
word-wrap: break-word;
9+
overflow-wrap: break-word;
10+
}
11+
</style>
12+
{% endblock %}
13+
314
{% block toolbar %}
415
{% if collector.platformCalls|length > 0 %}
516
{% set icon %}
@@ -13,8 +24,8 @@
1324
{% set text %}
1425
<div class="sf-toolbar-info-piece">
1526
<div class="sf-toolbar-info-piece">
16-
<b class="label">Chat Calls</b>
17-
<span class="sf-toolbar-status">{{ collector.chatCalls|length }}</span>
27+
<b class="label">Agent Calls</b>
28+
<span class="sf-toolbar-status">{{ collector.agentCalls|length }}</span>
1829
</div>
1930
<div class="sf-toolbar-info-piece">
2031
<b class="label">Configured Platforms</b>
@@ -62,8 +73,8 @@
6273
{% block panel %}
6374
<h2>Symfony AI</h2>
6475

65-
<h3>Chat Calls</h3>
66-
{% if collector.chatCalls|length %}
76+
<h3>Agent Calls</h3>
77+
{% if collector.agentCalls|length %}
6778
<table class="table">
6879
<thead>
6980
<tr>
@@ -75,15 +86,15 @@
7586
</tr>
7687
</thead>
7788
<tbody>
78-
{% for call in collector.chatCalls %}
89+
{% for call in collector.agentCalls %}
7990
<tr>
8091
<td><code>{{ call.method }}</code></td>
8192
<td class="text-nowrap">{{ (call.duration * 1000)|round(2) }} ms</td>
82-
<td>{{ dump(call.input) }}</td>
83-
<td>{{ dump(call.result) }}</td>
93+
<td><div style="max-width: 400px; overflow-x: auto;"><pre>{{ dump(call.input) }}</pre></div></td>
94+
<td><div style="max-width: 400px; overflow-x: auto;"><pre>{{ dump(call.result) }}</pre></div></td>
8495
<td>
8596
{% if call.error %}
86-
{{ dump(call.error) }}
97+
<pre>{{ dump(call.error) }}</pre>
8798
{% else %}
8899
<span class="text-muted">None</span>
89100
{% endif %}
@@ -94,19 +105,16 @@
94105
</table>
95106
{% else %}
96107
<div class="empty">
97-
<p>No chat calls were made.</p>
108+
<p>No agent calls were made.</p>
98109
</div>
99110
{% endif %}
100111

101112
<section class="metrics">
102113
<div class="metric-group">
103114
<div class="metric">
104-
<span class="value">{{ collector.chatCalls|length }}</span>
105-
<span class="label">Chat Calls</span>
115+
<span class="value">{{ collector.agentCalls|length }}</span>
116+
<span class="label">Agent Calls</span>
106117
</div>
107-
</div>
108-
<div class="metric-divider"></div>
109-
<div class="metric-group">
110118
<div class="metric">
111119
<span class="value">1</span>
112120
<span class="label">Platforms</span>
@@ -128,6 +136,7 @@
128136
</div>
129137
</div>
130138
</section>
139+
131140
<h3>Platform Calls</h3>
132141
{% if collector.platformCalls|length %}
133142
<div class="sf-tabs">
@@ -174,7 +183,7 @@
174183
{% endfor %}
175184
</ol>
176185
{% else %}
177-
{{ dump(call.input) }}
186+
<pre>{{ dump(call.input) }}</pre>
178187
{% endif %}
179188
</td>
180189
</tr>
@@ -192,7 +201,7 @@
192201
</ul>
193202
</li>
194203
{% else %}
195-
<li>{{ key }}: {{ dump(value) }}</li>
204+
<li>{{ key }}: <pre>{{ dump(value) }}</pre></li>
196205
{% endif %}
197206
{% endfor %}
198207
</ul>
@@ -283,11 +292,11 @@
283292
</tr>
284293
<tr>
285294
<th>Arguments</th>
286-
<td>{{ dump(call.call.arguments) }}</td>
295+
<td><pre>{{ dump(call.call.arguments) }}</pre></td>
287296
</tr>
288297
<tr>
289298
<th>Result</th>
290-
<td>{{ dump(call.result) }}</td>
299+
<td><pre>{{ dump(call.result) }}</pre></td>
291300
</tr>
292301
</tbody>
293302
</table>

0 commit comments

Comments
 (0)