spine-framework-portal 0.2.22 → 0.2.23
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.
- package/functions/custom_support-triage.ts +2 -0
- package/hooks/useTickets.ts +11 -0
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/pages/TicketsPage.tsx +25 -0
|
@@ -89,6 +89,7 @@ async function handleNewTicket(
|
|
|
89
89
|
data: {
|
|
90
90
|
aim_triage_agent_id: triageAgentId,
|
|
91
91
|
aim_confidence_at_response: confidence,
|
|
92
|
+
aim_retrieval_confidence: agentMsg?.data?.retrieval_confidence ?? null,
|
|
92
93
|
aim_escalation_reason: escalated ? 'low_confidence' : 'none',
|
|
93
94
|
}
|
|
94
95
|
})
|
|
@@ -131,6 +132,7 @@ async function handleReply(
|
|
|
131
132
|
data: {
|
|
132
133
|
...(currentTicket?.data || {}),
|
|
133
134
|
aim_confidence_at_response: confidence,
|
|
135
|
+
aim_retrieval_confidence: agentMsg?.data?.retrieval_confidence ?? null,
|
|
134
136
|
aim_escalation_reason: 'low_confidence',
|
|
135
137
|
}
|
|
136
138
|
})
|
package/hooks/useTickets.ts
CHANGED
|
@@ -187,6 +187,17 @@ export function useSubmitFeedback() {
|
|
|
187
187
|
}
|
|
188
188
|
}),
|
|
189
189
|
})
|
|
190
|
+
|
|
191
|
+
// Best-effort: record feedback in the core ai-interactions log
|
|
192
|
+
await fetchJSON('/.netlify/functions/ai-interactions', {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
body: JSON.stringify({
|
|
195
|
+
action: 'submit_feedback',
|
|
196
|
+
message_id: messageId,
|
|
197
|
+
ticket_id: ticketId,
|
|
198
|
+
feedback: feedback === 'up' ? 'helpful' : 'not_helpful',
|
|
199
|
+
}),
|
|
200
|
+
}).catch(() => null) // best-effort — don't fail the feedback submission if this fails
|
|
190
201
|
|
|
191
202
|
// If thumbs down, escalate to human
|
|
192
203
|
if (feedback === 'down') {
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "Portal",
|
|
3
3
|
"slug": "portal",
|
|
4
4
|
"description": "Self-service portal for customers to access tickets, knowledge base, courses, and community",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.23",
|
|
6
6
|
"app_type": "full",
|
|
7
7
|
"route_prefix": "/portal",
|
|
8
8
|
"required_roles": ["member", "member_admin"],
|
package/package.json
CHANGED
package/pages/TicketsPage.tsx
CHANGED
|
@@ -40,8 +40,33 @@ function AIResponseCard({ message, ticketId, messageId, onFeedback }: {
|
|
|
40
40
|
<Bot size={14} className="text-primary" />
|
|
41
41
|
<span className="text-xs font-medium text-muted-foreground">Spine Assistant</span>
|
|
42
42
|
</div>
|
|
43
|
+
{message.data?.confidence !== undefined && (
|
|
44
|
+
<div className="text-xs text-muted-foreground mt-1">
|
|
45
|
+
{message.data.confidence >= 0.85
|
|
46
|
+
? 'AI answered'
|
|
47
|
+
: message.data.confidence >= 0.60
|
|
48
|
+
? 'AI drafted · reviewed by support'
|
|
49
|
+
: 'Human answered'}
|
|
50
|
+
</div>
|
|
51
|
+
)}
|
|
43
52
|
<div className="leading-relaxed">{message.content}</div>
|
|
44
53
|
|
|
54
|
+
{Array.isArray(message.data?.retrieved_sources) && message.data.retrieved_sources.length > 0 && (
|
|
55
|
+
<details className="mt-2 text-xs text-muted-foreground">
|
|
56
|
+
<summary className="cursor-pointer hover:text-foreground">
|
|
57
|
+
Sources ({message.data.retrieved_sources.length})
|
|
58
|
+
</summary>
|
|
59
|
+
<ul className="mt-1 space-y-0.5 pl-2">
|
|
60
|
+
{message.data.retrieved_sources.slice(0, 3).map((s: any, i: number) => (
|
|
61
|
+
<li key={i} className="truncate">
|
|
62
|
+
{s.title || s.document_id}
|
|
63
|
+
{s.similarity ? ` — ${Math.round(s.similarity * 100)}%` : ''}
|
|
64
|
+
</li>
|
|
65
|
+
))}
|
|
66
|
+
</ul>
|
|
67
|
+
</details>
|
|
68
|
+
)}
|
|
69
|
+
|
|
45
70
|
{!feedback && (
|
|
46
71
|
<div className="flex items-center gap-2 mt-3 pt-3 border-t border-border/50">
|
|
47
72
|
<span className="text-xs text-muted-foreground">Was this helpful?</span>
|