Skip to content

Commit 3510a8c

Browse files
quanruyuyutaotao
andauthored
feat(web-integration): support unstableLogContent api for agent (#826)
* feat(web-integration): support unstableLogContent api for agent * fix(web-integration): use sync mehtod * docs(core): update API doc * fix(web-integration): playwright * docs(site): update --------- Co-authored-by: yutao <[email protected]>
1 parent c9f9a48 commit 3510a8c

29 files changed

+12731
-822
lines changed

apps/report/src/components/detail-side.tsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,7 @@ const DetailSide = (): JSX.Element => {
161161
<span key={index}>{elementEl(item)}</span>
162162
));
163163
} else {
164-
content =
165-
typeof value === 'string'
166-
? value
167-
: JSON.stringify(value, undefined, 2);
164+
content = <pre>{JSON.stringify(value, undefined, 2)}</pre>;
168165
}
169166

170167
return (
@@ -175,10 +172,6 @@ const DetailSide = (): JSX.Element => {
175172
});
176173
};
177174

178-
const usageInfo = (task as ExecutionTask)?.usage
179-
? JSON.stringify((task as ExecutionTask)?.usage, undefined, 2)
180-
: '';
181-
182175
const metaKVElement = MetaKV({
183176
data: [
184177
{
@@ -197,27 +190,38 @@ const DetailSide = (): JSX.Element => {
197190
key: 'total time',
198191
content: timeCostStrElement(task?.timing?.cost),
199192
},
200-
...(task?.timing?.aiCost
193+
...(task?.usage?.time_cost
201194
? [
202195
{
203196
key: 'AI service time',
204-
content: timeCostStrElement(task?.timing?.aiCost),
197+
content: <pre>{timeCostStrElement(task?.usage?.time_cost)}</pre>,
205198
},
206199
]
207200
: []),
208201
{
209202
key: 'cache',
210-
content: task?.cache ? JSON.stringify(task?.cache) : 'false',
203+
content: task?.cache ? (
204+
<pre>{JSON.stringify(task?.cache, undefined, 2)}</pre>
205+
) : (
206+
'false'
207+
),
211208
},
212209
...(task?.locate
213210
? [
214211
{
215212
key: 'locate',
216-
content: JSON.stringify(task.locate),
213+
content: <pre>{JSON.stringify(task.locate, undefined, 2)}</pre>,
214+
},
215+
]
216+
: []),
217+
...(task?.usage
218+
? [
219+
{
220+
key: 'usage',
221+
content: <pre>{JSON.stringify(task.usage, undefined, 2)}</pre>,
217222
},
218223
]
219224
: []),
220-
...(usageInfo ? [{ key: 'usage', content: usageInfo }] : []),
221225
],
222226
});
223227

@@ -383,7 +387,7 @@ const DetailSide = (): JSX.Element => {
383387

384388
const locateStr =
385389
item.type === 'Locate' && item.locate
386-
? JSON.stringify(item.locate)
390+
? JSON.stringify(item.locate, undefined, 2)
387391
: null;
388392

389393
return {
@@ -394,8 +398,12 @@ const DetailSide = (): JSX.Element => {
394398
<b>{typeStr(item as any)}</b>
395399
</p>
396400
<p>{item.thought}</p>
397-
<p>{paramStr}</p>
398-
<p>{locateStr}</p>
401+
<p>
402+
<pre>{paramStr}</pre>
403+
</p>
404+
<p>
405+
<pre>{locateStr}</pre>
406+
</p>
399407
</>
400408
),
401409
};

0 commit comments

Comments
 (0)