Spaces:
Paused

dushyantsingh0 commited on
Commit
6e45d8d
·
1 Parent(s): 4777084

backend stabilization

Browse files
frontend/apps/customer/src/components/ThreadView.tsx CHANGED
@@ -580,7 +580,7 @@ export const ThreadView: React.FC<ThreadViewProps> = ({ ticket: initialTicket, o
580
  )}
581
  </div>
582
 
583
- {(ticket.status?.toUpperCase() === 'RESOLVED' || ticket.status?.toUpperCase() === 'CLOSED') && (
584
  <div className="organic-surface organic-lume" style={{ padding: "48px", border: `2px solid var(--success)`, marginTop: "40px", background: "linear-gradient(135deg, rgba(16, 185, 129, 0.03) 0%, rgba(255, 255, 255, 0) 100%)", borderRadius: 32 }}>
585
  <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", marginBottom: 32 }}>
586
  <div>
@@ -593,7 +593,7 @@ export const ThreadView: React.FC<ThreadViewProps> = ({ ticket: initialTicket, o
593
  </div>
594
  )}
595
 
596
- {(ticket.status?.toUpperCase() === 'RESOLVED' || ticket.status?.toUpperCase() === 'CLOSED') && (
597
  <div style={{ marginTop: 40 }}>
598
  <h3 className="metadata" style={{ marginBottom: 20, fontSize: 10, letterSpacing: '0.05em', fontWeight: 700, color: "var(--text-muted)" }}>Service Satisfaction</h3>
599
  <div className="organic-surface" style={{ padding: 40, borderRadius: 24, textAlign: 'center', background: '#fff', border: '1px solid var(--border-subtle)' }}>
 
580
  )}
581
  </div>
582
 
583
+ {(['RESOLVED', 'CLOSED'].includes((ticket.status || '').toUpperCase()) || ticket.resolution_text) && (
584
  <div className="organic-surface organic-lume" style={{ padding: "48px", border: `2px solid var(--success)`, marginTop: "40px", background: "linear-gradient(135deg, rgba(16, 185, 129, 0.03) 0%, rgba(255, 255, 255, 0) 100%)", borderRadius: 32 }}>
585
  <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", marginBottom: 32 }}>
586
  <div>
 
593
  </div>
594
  )}
595
 
596
+ {(['RESOLVED', 'CLOSED'].includes((ticket.status || '').toUpperCase()) || ticket.resolution_text) && (
597
  <div style={{ marginTop: 40 }}>
598
  <h3 className="metadata" style={{ marginBottom: 20, fontSize: 10, letterSpacing: '0.05em', fontWeight: 700, color: "var(--text-muted)" }}>Service Satisfaction</h3>
599
  <div className="organic-surface" style={{ padding: 40, borderRadius: 24, textAlign: 'center', background: '#fff', border: '1px solid var(--border-subtle)' }}>
frontend/apps/internal/src/components/KnowledgeBase.module.css CHANGED
@@ -20,8 +20,8 @@
20
  overflow: visible;
21
  display: flex;
22
  flex-direction: column;
23
- align-items: center;
24
- text-align: center;
25
  }
26
 
27
  @keyframes meshGradient {
@@ -46,7 +46,7 @@
46
  width: 100%;
47
  display: flex;
48
  flex-direction: column;
49
- align-items: center;
50
  overflow: visible;
51
  }
52
 
@@ -64,7 +64,7 @@
64
  .headerMainRow {
65
  display: flex;
66
  align-items: center;
67
- justify-content: center;
68
  gap: 32px;
69
  margin-bottom: 16px;
70
  width: 100%;
@@ -88,7 +88,7 @@
88
  color: rgba(255, 255, 255, 0.9);
89
  margin-bottom: 48px;
90
  font-weight: 500;
91
- max-width: 600px;
92
  }
93
 
94
  /* Search Controls */
 
20
  overflow: visible;
21
  display: flex;
22
  flex-direction: column;
23
+ align-items: flex-start;
24
+ text-align: left;
25
  }
26
 
27
  @keyframes meshGradient {
 
46
  width: 100%;
47
  display: flex;
48
  flex-direction: column;
49
+ align-items: flex-start;
50
  overflow: visible;
51
  }
52
 
 
64
  .headerMainRow {
65
  display: flex;
66
  align-items: center;
67
+ justify-content: flex-start;
68
  gap: 32px;
69
  margin-bottom: 16px;
70
  width: 100%;
 
88
  color: rgba(255, 255, 255, 0.9);
89
  margin-bottom: 48px;
90
  font-weight: 500;
91
+ max-width: 800px;
92
  }
93
 
94
  /* Search Controls */
frontend/apps/internal/src/components/TicketDetails.tsx CHANGED
@@ -1078,12 +1078,12 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
1078
  </div>
1079
  </div>
1080
 
1081
- {/* Resolution Snapshot (Visible when resolved/closed) */}
1082
- {ticket.resolution_text && (
1083
  <div className={styles.resolutionCard}>
1084
  <div className={styles.aiHeader}>
1085
  <div className={styles.aiBadge} style={{ color: 'var(--success)' }}>
1086
- <ShieldCheck size={16} /> RESOLUTION SNAPSHOT
1087
  </div>
1088
  <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
1089
  {isStaff && (
@@ -1092,16 +1092,17 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
1092
  className={styles.btnSecondary}
1093
  style={{ padding: '4px 8px', fontSize: 10 }}
1094
  >
1095
- Edit Resolution
1096
  </button>
1097
  )}
1098
- <div className={styles.metadata} style={{ fontSize: 10, fontWeight: 700, color: 'var(--text-dim)' }}>
1099
- {ticket.resolved_at ? `RESOLVED ${new Date(ticket.resolved_at).toLocaleDateString()}` : 'RESOLVED'}
 
1100
  </div>
1101
  </div>
1102
  </div>
1103
  <div className={styles.intelligenceSurface} style={{ background: 'rgba(16, 185, 129, 0.02)', border: '1px solid rgba(16, 185, 129, 0.1)' }}>
1104
- <NexusMarkdown content={ticket.resolution_text} />
1105
  </div>
1106
  </div>
1107
  )}
@@ -1149,31 +1150,6 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
1149
  </div>
1150
  </section>
1151
 
1152
- {/* Resolution Intelligence Documentation */}
1153
- {(ticket.resolution_text || ticket.status === 'RESOLVED') && (
1154
- <section className={styles.sectionBlock} style={{ marginTop: 32 }}>
1155
- <div className={styles.sectionTitle}>RESOLUTION INTELLIGENCE</div>
1156
- <div className={styles.resolutionCard}>
1157
- <div className={styles.aiHeader}>
1158
- <div className={styles.aiBadge} style={{ color: 'var(--success)' }}>
1159
- <ShieldCheck size={16} /> FINAL RESOLUTION VERIFIED
1160
- </div>
1161
- </div>
1162
- <div className={styles.intelligenceSurface}>
1163
- <div style={{ position: 'relative' }}>
1164
- <NexusMarkdown content={ticket.resolution_text || "Awaiting final documentation..."} />
1165
- {ticket.status === 'RESOLVED' && isStaff && (
1166
- <button
1167
- onClick={() => { setResolutionDraft(ticket.resolution_text || ""); setShowResolutionModal(true); }}
1168
- className={styles.btnSecondary}
1169
- style={{ position: 'absolute', top: -32, right: -12, fontSize: 10, padding: '4px 8px' }}
1170
- >Edit Resolution</button>
1171
- )}
1172
- </div>
1173
- </div>
1174
- </div>
1175
- </section>
1176
- )}
1177
  </main>
1178
 
1179
  {/* Right Sidebar (Collaboration & History) */}
 
1078
  </div>
1079
  </div>
1080
 
1081
+ {/* Resolution HUD (Prominent for Resolved/Closed states, draftable for staff) */}
1082
+ {(isStaff || ticket.status === 'RESOLVED' || ticket.status === 'CLOSED' || ticket.resolution_text) && (
1083
  <div className={styles.resolutionCard}>
1084
  <div className={styles.aiHeader}>
1085
  <div className={styles.aiBadge} style={{ color: 'var(--success)' }}>
1086
+ <ShieldCheck size={16} /> FINAL RESOLUTION HUD
1087
  </div>
1088
  <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
1089
  {isStaff && (
 
1092
  className={styles.btnSecondary}
1093
  style={{ padding: '4px 8px', fontSize: 10 }}
1094
  >
1095
+ {ticket.resolution_text ? 'Edit Resolution' : 'Add Resolution'}
1096
  </button>
1097
  )}
1098
+ <div className={styles.metadata} style={{ fontSize: 10, fontWeight: 700, color: 'var(--text-dim)', textAlign: 'right' }}>
1099
+ {ticket.resolved_by_name && <div>RESOLVED BY: {ticket.resolved_by_name.toUpperCase()}</div>}
1100
+ <div>{ticket.resolved_at ? `TIMESTAMP: ${new Date(ticket.resolved_at).toLocaleString()}` : 'RESOLUTION PENDING'}</div>
1101
  </div>
1102
  </div>
1103
  </div>
1104
  <div className={styles.intelligenceSurface} style={{ background: 'rgba(16, 185, 129, 0.02)', border: '1px solid rgba(16, 185, 129, 0.1)' }}>
1105
+ <NexusMarkdown content={ticket.resolution_text || "_Neural synchronization awaiting final resolution documentation..._"} />
1106
  </div>
1107
  </div>
1108
  )}
 
1150
  </div>
1151
  </section>
1152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1153
  </main>
1154
 
1155
  {/* Right Sidebar (Collaboration & History) */}
scratch/check_tickets.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import sys
3
+ if sys.platform == 'win32':
4
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
5
+ from sqlalchemy import select
6
+ from core.database import async_session_factory
7
+ from models.ticket import Ticket, TicketStatus
8
+
9
+ async def check_resolved_tickets():
10
+ async with async_session_factory() as session:
11
+ stmt = select(Ticket).where(Ticket.status == TicketStatus.RESOLVED)
12
+ res = await session.execute(stmt)
13
+ tickets = res.scalars().all()
14
+
15
+ print(f"Found {len(tickets)} resolved tickets.")
16
+ for t in tickets:
17
+ print(f"ID: {t.id}")
18
+ print(f"Status: {t.status}")
19
+ print(f"Resolution Text: {t.resolution_text}")
20
+ print(f"Resolved At: {t.resolved_at}")
21
+ print("-" * 20)
22
+
23
+ if __name__ == "__main__":
24
+ asyncio.run(check_resolved_tickets())