|
1 | 1 | <template> |
2 | 2 | <div class="tool" :data-tool-name="toolCall.toolName" :data-tool-state="toolCall.state" |
3 | | - :data-tool-empty-result="isEmptyResult"> |
| 3 | + :data-tool-empty-result="isEmptyResult" :data-tool-error="!!error"> |
4 | 4 | <div class="tool-name">{{ displayName }}</div> |
5 | 5 | <markdown v-if="toolCall.toolName === 'run_query'" :content="'```sql\n' + toolCall.args.query + '\n```'" /> |
6 | 6 | <div v-if="askingPermission"> |
|
20 | 20 | </button> |
21 | 21 | </div> |
22 | 22 | </div> |
23 | | - <div :class="{ 'error tool-error': error }"> |
24 | | - <template v-if="error">{{ error }}</template> |
25 | | - <template v-else-if="data"> |
26 | | - <template v-if="toolCall.toolName === 'get_connection_info'"> |
27 | | - {{ data.connectionType }} |
28 | | - </template> |
29 | | - <template v-if="toolCall.toolName === 'get_tables'"> |
30 | | - {{ data.length }} |
31 | | - {{ $pluralize("table", data.length) }} |
32 | | - (<code v-text="truncateAtWord(data.map((t) => t.name).join(', '))" />) |
33 | | - </template> |
34 | | - <template v-if="toolCall.toolName === 'get_columns'"> |
35 | | - {{ data.length }} |
36 | | - {{ $pluralize("column", data.length) }} |
37 | | - (<code v-if="data.length < 5" v-text="data.map((c) => c.name).join(', ')" />) |
38 | | - </template> |
39 | | - <run-query-result v-else-if="toolCall.toolName === 'run_query' && data" :data="data" /> |
| 23 | + <div class="tool-error error" v-if="error" v-text="error" /> |
| 24 | + <div class="tool-result" v-else-if="data"> |
| 25 | + <template v-if="toolCall.toolName === 'get_connection_info'"> |
| 26 | + {{ data.connectionType }} |
40 | 27 | </template> |
| 28 | + <template v-if="toolCall.toolName === 'get_tables'"> |
| 29 | + {{ data.length }} |
| 30 | + {{ $pluralize("table", data.length) }} |
| 31 | + </template> |
| 32 | + <template v-if="toolCall.toolName === 'get_columns'"> |
| 33 | + {{ data.length }} |
| 34 | + {{ $pluralize("column", data.length) }} |
| 35 | + </template> |
| 36 | + <run-query-result v-else-if="toolCall.toolName === 'run_query' && data" :data="data" /> |
41 | 37 | </div> |
42 | 38 | </div> |
43 | 39 | </template> |
@@ -105,7 +101,7 @@ export default { |
105 | 101 | if (this.toolCall.args.schema) { |
106 | 102 | return `Get Columns (schema: ${this.toolCall.args.schema}, table: ${this.toolCall.args.table})`; |
107 | 103 | } |
108 | | - return `Get Columns (table: ${this.toolCall.args.table})`; |
| 104 | + return `Get Columns (${this.toolCall.args.table})`; |
109 | 105 | } |
110 | 106 | return this.toolCall.toolName.split("_").map(_.capitalize).join(" "); |
111 | 107 | }, |
|
0 commit comments