@m6d/cortex-angular 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -48,6 +48,7 @@ function checkAttachmentPolicy(file) {
|
|
|
48
48
|
return "ok";
|
|
49
49
|
}
|
|
50
50
|
var STATEMENT_TOOLS = ["executeCode", "queryDataset", "describeDataset"];
|
|
51
|
+
var APPROVAL_TITLE_FIELD = "approvalTitle";
|
|
51
52
|
function toolCallMetadataOf(part) {
|
|
52
53
|
const metadata = part.metadata;
|
|
53
54
|
return metadata?.cortex ?? undefined;
|
|
@@ -724,15 +725,19 @@ function toolCallAnimation(part) {
|
|
|
724
725
|
rows: state === "complete" ? toolCallRows(part) : undefined
|
|
725
726
|
};
|
|
726
727
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
728
|
+
function approvalTitle(part) {
|
|
729
|
+
const input = part.input;
|
|
730
|
+
if (!input || typeof input !== "object" || !(APPROVAL_TITLE_FIELD in input))
|
|
731
|
+
return;
|
|
732
|
+
const title = input[APPROVAL_TITLE_FIELD];
|
|
733
|
+
return typeof title === "string" && title.trim() ? title.trim() : undefined;
|
|
729
734
|
}
|
|
730
735
|
function approvalCard(part, locale) {
|
|
731
736
|
const approved = part.approval?.approved;
|
|
732
737
|
const { state } = toolCallAnimation(part);
|
|
733
738
|
const decision = approved === undefined ? part.state === "approval-requested" ? "pending" : "cancelled" : !approved ? "declined" : state === "error" ? "failed" : "approved";
|
|
734
739
|
return {
|
|
735
|
-
sentence:
|
|
740
|
+
sentence: approvalTitle(part) ?? translate(locale, "translate_approval_action", { tool: wordsOf(part.name) }),
|
|
736
741
|
decision,
|
|
737
742
|
decisionKey: DECISION_KEYS[decision]
|
|
738
743
|
};
|