@@ -11,12 +11,28 @@ interface Props {
11
11
const { run, call, referredTo, callMap, depth= 0 } = defineProps <Props >()
12
12
const prefs = usePrefs ()
13
13
14
+ const isExpanded = computed (() => {
15
+ return prefs .allExpanded || prefs .expanded [call .id ] || false
16
+ })
17
+
14
18
const 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 )
16
20
})
17
21
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
+ }
20
36
})
21
37
22
38
const icon = computed (() => {
@@ -54,38 +70,71 @@ const displayName = computed(() => {
54
70
55
71
return id .replace (/ :1$ / ,' ' )
56
72
})
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
+
57
100
</script >
58
101
<template >
59
- <UCard :key =" call.id" class =" call" >
102
+ <UCard :key =" call.id" class =" call mt-3 " >
60
103
<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 " >
63
106
<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 " />
65
108
{{displayName}}
109
+ <template v-if =" ! isExpanded " >({{inputShort}}) <i class =" i-heroicons-arrow-right align-text-bottom" /> {{outputShort}}</template >
66
110
</div >
67
111
</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">
70
118
<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 " >
73
121
<i :class =" iconForState(call.state)" />  ; {{ucFirst(call.state)}}
74
122
</UBadge >
75
123
</div >
76
124
</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 >
79
128
</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 >
82
131
</div >
83
132
84
- <template v-if =" isExpanded && call . messages ?. length " >
133
+ <template v-if =" isExpanded " >
85
134
<Message
86
- v-for =" (msg, idx) in call. messages"
135
+ v-for =" (msg, idx) in messages"
87
136
:key =" idx"
88
- class =" my-2 "
137
+ class =" mt-1 "
89
138
:run =" run"
90
139
:call =" call"
91
140
:msg =" msg"
@@ -95,9 +144,7 @@ const displayName = computed(() => {
95
144
/>
96
145
</template >
97
146
98
- <div v-if =" isExpanded && children.length" class =" ml-5" >
99
- CHILDREN
100
- {{referredTo}}
147
+ <div v-if =" children.length" class =" ml-9" >
101
148
<Call
102
149
v-for =" (child, idx) in children"
103
150
:key =" idx"
0 commit comments