fix(messaging): show tool argument values in chat, redacting only sensitive keys
This commit is contained in:
1 parent
e100b01c52
commit
2bcfcf6ea8
4 files changed
+39
-5
No files matched your search
@@ -56,7 +56,21 @@ const duration = computed(() => {
|
||||
if (!ms) return "";
|
||||
return ms < 1000 ? `${ms}ms` : `${(ms / 1000).toFixed(ms < 10000 ? 1 : 0)}s`;
|
||||
});
|
||||
const argument = computed(() => parameters.value.split("\n", 1)[0]);
|
||||
// The row shows the call's main value, as "git diff --stat" rather than its
|
||||
// JSON: the first string argument, else the parameters as sent.
|
||||
const argument = computed(() => {
|
||||
try {
|
||||
const args: unknown = JSON.parse(parameters.value);
|
||||
if (args && typeof args === "object" && !Array.isArray(args)) {
|
||||
const first = Object.values(args).find((v) => typeof v === "string" && v);
|
||||
if (typeof first === "string") return first.split("\n", 1)[0];
|
||||
if (Object.keys(args).length === 0) return "";
|
||||
}
|
||||
} catch {
|
||||
// Truncated or not JSON: show it as it came.
|
||||
}
|
||||
return parameters.value.split("\n", 1)[0];
|
||||
});
|
||||
const detail = computed(() =>
|
||||
[parameters.value && `> ${parameters.value}`, outcome.value].filter(Boolean).join("\n\n"),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user