@@ -11,12 +11,28 @@ interface Props {
1111const { run, call, referredTo, callMap, depth= 0 } = defineProps <Props >()
1212const prefs = usePrefs ()
1313
14+ const isExpanded = computed (() => {
15+ return prefs .allExpanded || prefs .expanded [call .id ] || false
16+ })
17+
1418const children = computed (() => {
15- return run .calls .filter (x => ! referredTo [x .id ] && x .parentID && x .parentID === call .id )
19+ return run .calls .filter (x => ( ! isExpanded . value || ! call . showSystemMessages || ! referredTo [x .id ]) && x .parentID && x .parentID === call .id )
1620})
1721
18- const isExpanded = computed (() => {
19- return prefs .allExpanded || prefs .expanded [call .id ] || false
22+ const messages = computed (() => {
23+ const all = call .messages || []
24+
25+ if ( call .showSystemMessages ) {
26+ return all .slice ()
27+ } else {
28+ return all .filter ((msg ) => {
29+ if ( (' role' in msg ) ) {
30+ return false
31+ }
32+
33+ return true
34+ })
35+ }
2036})
2137
2238const icon = computed (() => {
@@ -54,38 +70,71 @@ const displayName = computed(() => {
5470
5571 return id .replace (/ :1$ / ,' ' )
5672})
73+
74+ const inputLimit = 50
75+ const outputLimit = 100
76+ const inputDisplay = computed (() => {
77+ return ` ${call .input || ' <none>' } `
78+ })
79+
80+ const inputShort = computed (() => {
81+ return inputDisplay .value .substring (0 , inputLimit ) + (inputTruncated .value ? ' …' : ' ' )
82+ })
83+
84+ const inputTruncated = computed (() => {
85+ return inputDisplay .value .length > inputLimit
86+ })
87+
88+ const outputDisplay = computed (() => {
89+ return ` ${call .output || ' <none>' } `
90+ })
91+
92+ const outputShort = computed (() => {
93+ return outputDisplay .value .substring (0 , outputLimit ) + (outputTruncated .value ? ' …' : ' ' )
94+ })
95+
96+ const outputTruncated = computed (() => {
97+ return outputDisplay .value .length > outputLimit
98+ })
99+
57100 </script >
58101<template >
59- <UCard :key =" call.id" class =" call" >
102+ <UCard :key =" call.id" class =" call mt-3 " >
60103 <i v-if =" prefs.debug" class =" text-blue-400" >{{call}}</i >
61- <div class =" clearfix " >
62- <div class =" float-left " >
104+ <div class =" flex " :class = " [isExpanded && 'mb-2'] " >
105+ <div class =" flex-1 " >
63106 <div >
64- <UButton v-if =" children.length || call.messages?.length" size =" xs" :icon =" icon" @click =" toggle" class =" align-baseline" />
107+ <UButton v-if =" children.length || call.messages?.length || inputTruncated || outputTruncated " size =" xs" :icon =" icon" @click =" toggle" class =" align-baseline mr-1 " />
65108 {{displayName}}
109+ <template v-if =" ! isExpanded " >({{inputShort}}) <i class =" i-heroicons-arrow-right align-text-bottom" /> {{outputShort}}</template >
66110 </div >
67111 </div >
68- <div class =" float-right" >
69- <UBadge class =" align-baseline mr-2" :id =" call.id" >
112+ <div class =" flex-inline text-right" >
113+ <UTooltip v-if =" isExpanded" :text =" call.showSystemMessages ? 'Internal messages shown' : 'Internal messages hidden'" >
114+ <UToggle v-model =" call.showSystemMessages" class =" mr-2" off-icon =" i-heroicons-bars-2" on-icon =" i-heroicons-bars-4" />
115+ </UTooltip >
116+
117+ <!-- <UBadge size="md" class="align-baseline mr-2" :id="call.id" variant="subtle">
70118 <i class="i-heroicons-key"/> {{ prefs.mapCall(call.id) }}
71- </UBadge >
72- <UBadge :color =" colorForState(call.state)" class =" align-baseline" >
119+ </UBadge> -->
120+ <UBadge size = " md " :color =" colorForState(call.state)" class =" align-baseline" variant = " subtle " >
73121 <i :class =" iconForState(call.state)" />  ; {{ucFirst(call.state)}}
74122 </UBadge >
75123 </div >
76124 </div >
77- <div >
78- <b >Input:</b > {{call.input || '<none >'}}
125+
126+ <div v-if =" isExpanded" >
127+ <b >Input:</b > <span class =" whitespace-pre-wrap" >{{call.input || '<none >'}}</span >
79128 </div >
80- <div >
81- <b >Output:</b > <span v-html = " nlToBr( call.output || '<none>') " / >
129+ <div v-if = " isExpanded " >
130+ <b >Output:</b > <span class = " whitespace-pre-wrap " >{{ call.output || '<none >'}}</ span >
82131 </div >
83132
84- <template v-if =" isExpanded && call . messages ?. length " >
133+ <template v-if =" isExpanded " >
85134 <Message
86- v-for =" (msg, idx) in call. messages"
135+ v-for =" (msg, idx) in messages"
87136 :key =" idx"
88- class =" my-2 "
137+ class =" mt-1 "
89138 :run =" run"
90139 :call =" call"
91140 :msg =" msg"
@@ -95,9 +144,7 @@ const displayName = computed(() => {
95144 />
96145 </template >
97146
98- <div v-if =" isExpanded && children.length" class =" ml-5" >
99- CHILDREN
100- {{referredTo}}
147+ <div v-if =" children.length" class =" ml-9" >
101148 <Call
102149 v-for =" (child, idx) in children"
103150 :key =" idx"
0 commit comments