@b2y/ai-service 0.0.0-stage → 1.0.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.
- package/README.md +163 -2
- package/package.json +77 -4
- package/src/analytics/Analytics.js +581 -0
- package/src/analytics/Results.js +394 -0
- package/src/constants/AnalyticsConstants.js +6 -0
- package/src/constants/AssistantConstants.js +5 -0
- package/src/constants/ConversationConstants.js +5 -0
- package/src/constants/DocumentConstants.js +4 -0
- package/src/constants/ProviderConstants.js +23 -0
- package/src/constants/ServerConstants.js +15 -0
- package/src/constants/SqlConstants.js +33 -0
- package/src/constants/UiConstants.js +29 -0
- package/src/conversations/ConversationHistory.js +191 -0
- package/src/conversations/FolderConversationStore.js +103 -0
- package/src/copilot/Assistant.js +459 -0
- package/src/copilot/Capabilities.js +343 -0
- package/src/core/AiService.js +520 -0
- package/src/core/Context.js +243 -0
- package/src/core/Errors.js +249 -0
- package/src/core/Tasks.js +190 -0
- package/src/documents/Documents.js +450 -0
- package/src/documents/FolderDocumentStore.js +167 -0
- package/src/documents/PdfText.js +50 -0
- package/src/enums/ChartType.js +1 -0
- package/src/enums/DataClassification.js +2 -0
- package/src/enums/ProviderType.js +1 -0
- package/src/index.js +65 -0
- package/src/providers/Providers.js +733 -0
- package/src/server/Server.js +153 -0
- package/src/sql/PostgresSqlValidator.js +983 -0
- package/src/sql/SqlPolicy.js +483 -0
- package/src/ui/react/AssistantChat.js +594 -0
- package/src/ui/react/styles.css +239 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/* @b2y/ai-service chat UI. Theme with --b2y-ai-* variables; .b2y-ai-theme applies it to an app's own layout. */
|
|
2
|
+
.b2y-ai-chat, .b2y-ai-theme {
|
|
3
|
+
--_accent: var(--b2y-ai-accent, #4f46e5);
|
|
4
|
+
--_accent-soft: var(--b2y-ai-accent-soft, color-mix(in srgb, var(--_accent) 10%, transparent));
|
|
5
|
+
--_text: var(--b2y-ai-text, #111827);
|
|
6
|
+
--_muted: var(--b2y-ai-muted, #6b7280);
|
|
7
|
+
--_border: var(--b2y-ai-border, #e5e7eb);
|
|
8
|
+
--_surface: var(--b2y-ai-surface, #f6f7f9);
|
|
9
|
+
--_bg: var(--b2y-ai-background, #ffffff);
|
|
10
|
+
--_radius: 14px;
|
|
11
|
+
font-family: var(--b2y-ai-font, inherit);
|
|
12
|
+
color: var(--_text);
|
|
13
|
+
}
|
|
14
|
+
.b2y-ai-chat {
|
|
15
|
+
position: relative;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
height: var(--b2y-ai-height, min(80vh, 860px));
|
|
19
|
+
min-height: 420px;
|
|
20
|
+
background: var(--_bg);
|
|
21
|
+
border: 1px solid var(--_border);
|
|
22
|
+
border-radius: var(--b2y-ai-radius, 18px);
|
|
23
|
+
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
line-height: 1.6;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
.b2y-ai-chat *, .b2y-ai-chat *::before, .b2y-ai-chat *::after, .b2y-ai-theme *, .b2y-ai-theme *::before, .b2y-ai-theme *::after { box-sizing: border-box; }
|
|
29
|
+
.b2y-ai-chat button, .b2y-ai-theme button { font: inherit; }
|
|
30
|
+
.b2y-ai-chat button:focus-visible, .b2y-ai-chat a:focus-visible, .b2y-ai-theme button:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }
|
|
31
|
+
|
|
32
|
+
/* Header */
|
|
33
|
+
.b2y-ai-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--_border); background: var(--_bg); }
|
|
34
|
+
.b2y-ai-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
35
|
+
.b2y-ai-title > div { display: flex; flex-direction: column; min-width: 0; }
|
|
36
|
+
.b2y-ai-title strong { font-size: 15px; font-weight: 600; line-height: 1.3; }
|
|
37
|
+
.b2y-ai-title span:not(.b2y-ai-avatar) { font-size: 12px; color: var(--_muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
38
|
+
.b2y-ai-actions { display: flex; gap: 6px; flex-shrink: 0; }
|
|
39
|
+
.b2y-ai-ghost { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--_border); border-radius: 10px; padding: 6px 10px; font-size: 13px; color: var(--_text); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
|
|
40
|
+
.b2y-ai-ghost:hover:not(:disabled) { background: var(--_surface); border-color: color-mix(in srgb, var(--_accent) 40%, var(--_border)); }
|
|
41
|
+
.b2y-ai-ghost:disabled { opacity: 0.45; cursor: default; }
|
|
42
|
+
.b2y-ai-history { position: absolute; z-index: 5; top: calc(100% + 6px); right: 16px; width: min(340px, calc(100% - 32px)); max-height: 340px; overflow-y: auto; background: var(--_bg); border: 1px solid var(--_border); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14); padding: 6px; animation: b2y-ai-in 0.16s ease-out; }
|
|
43
|
+
.b2y-ai-history-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--_text); }
|
|
44
|
+
.b2y-ai-history-item span { font-size: 13px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
45
|
+
.b2y-ai-history-item time { font-size: 11px; color: var(--_muted); }
|
|
46
|
+
.b2y-ai-history-item:hover, .b2y-ai-history-item.b2y-ai-active { background: var(--_accent-soft); }
|
|
47
|
+
|
|
48
|
+
/* Avatar */
|
|
49
|
+
.b2y-ai-avatar { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; color: var(--_text); background: var(--_bg); border: 1.5px solid var(--_border); }
|
|
50
|
+
|
|
51
|
+
/* Messages */
|
|
52
|
+
.b2y-ai-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 20px 16px 12px; scroll-behavior: smooth; background: linear-gradient(var(--_bg), color-mix(in srgb, var(--_surface) 55%, var(--_bg))); }
|
|
53
|
+
.b2y-ai-row { display: flex; gap: 10px; align-items: flex-start; animation: b2y-ai-in 0.22s ease-out; }
|
|
54
|
+
.b2y-ai-row-user { justify-content: flex-end; }
|
|
55
|
+
.b2y-ai-bubble-user { margin: 0; max-width: min(78%, 640px); background: var(--_accent); color: #fff; padding: 9px 14px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08); }
|
|
56
|
+
.b2y-ai-bubble { min-width: 0; max-width: min(88%, 760px); background: var(--_bg); border: 1px solid var(--_border); border-radius: 6px 18px 18px 18px; padding: 12px 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
|
|
57
|
+
.b2y-ai-bubble:has(.b2y-ai-card, .b2y-ai-metrics, .b2y-ai-cards) { flex: 1; min-width: 0; }
|
|
58
|
+
.b2y-ai-answer { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
|
|
59
|
+
.b2y-ai-paragraph { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
60
|
+
.b2y-ai-heading { margin: 2px 0 -2px; font-size: 14.5px; font-weight: 600; }
|
|
61
|
+
.b2y-ai-bullets { margin: 0; padding-left: 20px; }
|
|
62
|
+
.b2y-ai-bullets li { padding-left: 2px; }
|
|
63
|
+
.b2y-ai-bullets li + li { margin-top: 4px; }
|
|
64
|
+
.b2y-ai-bullets li::marker { color: var(--_accent); }
|
|
65
|
+
|
|
66
|
+
/* Cards: metrics, tables, charts */
|
|
67
|
+
.b2y-ai-card { margin: 0; border: 1px solid var(--_border); border-radius: 12px; background: var(--_bg); overflow: hidden; }
|
|
68
|
+
.b2y-ai-card-title { font-size: 12.5px; font-weight: 600; padding: 10px 12px 0; color: var(--_text); }
|
|
69
|
+
.b2y-ai-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
|
|
70
|
+
.b2y-ai-metric { border: 1px solid var(--_border); border-radius: 12px; padding: 10px 12px; background: var(--_surface); display: flex; flex-direction: column; gap: 2px; }
|
|
71
|
+
.b2y-ai-metric-value { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
|
|
72
|
+
.b2y-ai-metric-label { font-size: 12px; color: var(--_muted); }
|
|
73
|
+
.b2y-ai-table-wrap { overflow: auto; max-height: 360px; }
|
|
74
|
+
.b2y-ai-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
|
|
75
|
+
.b2y-ai-table th { position: sticky; top: 0; text-align: left; font-weight: 600; font-size: 12px; color: var(--_muted); background: var(--_surface); padding: 8px 12px; border-bottom: 1px solid var(--_border); white-space: nowrap; }
|
|
76
|
+
.b2y-ai-table td { padding: 8px 12px; border-bottom: 1px solid var(--_border); }
|
|
77
|
+
.b2y-ai-table tbody tr:last-child td { border-bottom: 0; }
|
|
78
|
+
.b2y-ai-table tbody tr:hover td { background: var(--_accent-soft); }
|
|
79
|
+
.b2y-ai-table th.b2y-ai-num { text-align: right; }
|
|
80
|
+
.b2y-ai-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
81
|
+
.b2y-ai-muted { color: var(--_muted); font-size: 12px; margin: 6px 12px; }
|
|
82
|
+
.b2y-ai-chart svg { width: 100%; height: auto; max-height: 240px; display: block; padding: 8px 8px 4px; }
|
|
83
|
+
.b2y-ai-axis { stroke: var(--_border); }
|
|
84
|
+
.b2y-ai-grid { stroke: var(--_border); stroke-dasharray: 3 4; opacity: 0.7; }
|
|
85
|
+
.b2y-ai-value { font-size: 10px; font-weight: 600; fill: var(--_text); }
|
|
86
|
+
.b2y-ai-tick { font-size: 10px; fill: var(--_muted); }
|
|
87
|
+
.b2y-ai-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--_muted); padding: 0 12px 10px; }
|
|
88
|
+
.b2y-ai-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
|
|
89
|
+
.b2y-ai-flow ol { margin: 0; padding: 10px 12px 12px 34px; display: flex; flex-direction: column; gap: 6px; }
|
|
90
|
+
.b2y-ai-flow ol > li { padding: 6px 10px; border: 1px solid var(--_border); border-radius: 10px; background: var(--_surface); }
|
|
91
|
+
.b2y-ai-flow ol > li::marker { color: var(--_accent); font-weight: 600; }
|
|
92
|
+
.b2y-ai-flow .b2y-ai-flow-start, .b2y-ai-flow .b2y-ai-flow-end { background: var(--_accent-soft); font-weight: 500; }
|
|
93
|
+
.b2y-ai-flow .b2y-ai-flow-decision { border-style: dashed; }
|
|
94
|
+
.b2y-ai-flow ul { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--_muted); }
|
|
95
|
+
.b2y-ai-notice { border-radius: 12px; padding: 10px 12px; font-size: 13px; }
|
|
96
|
+
.b2y-ai-notice ul { margin: 2px 0 0; padding-left: 18px; }
|
|
97
|
+
.b2y-ai-notice-info { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
|
|
98
|
+
.b2y-ai-notice-warning { background: #fffbeb; color: #78350f; border: 1px solid #fde68a; }
|
|
99
|
+
.b2y-ai-sources { font-size: 12px; color: var(--_muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
|
100
|
+
.b2y-ai-sources a, .b2y-ai-sources span + span { padding: 2px 8px; border-radius: 999px; background: var(--_surface); border: 1px solid var(--_border); color: var(--_accent); text-decoration: none; }
|
|
101
|
+
|
|
102
|
+
/* Empty, loading and error states */
|
|
103
|
+
.b2y-ai-empty { margin: auto; max-width: 560px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 24px 8px; animation: b2y-ai-in 0.25s ease-out; }
|
|
104
|
+
.b2y-ai-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 999px; color: var(--_text); background: var(--_accent-soft); }
|
|
105
|
+
.b2y-ai-greeting { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; background: linear-gradient(90deg, var(--_text), color-mix(in srgb, var(--_accent) 75%, var(--_text))); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
|
106
|
+
.b2y-ai-intro { color: var(--_muted); margin: 0; font-size: 14.5px; }
|
|
107
|
+
.b2y-ai-suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; width: 100%; }
|
|
108
|
+
.b2y-ai-suggestions button { text-align: left; border: 1px solid var(--_border); background: var(--_bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; cursor: pointer; color: var(--_text); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
|
|
109
|
+
.b2y-ai-suggestions button:hover { border-color: var(--_accent); box-shadow: 0 4px 12px rgba(16, 24, 40, 0.06); transform: translateY(-1px); }
|
|
110
|
+
.b2y-ai-restoring { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--_muted); font-size: 13px; }
|
|
111
|
+
.b2y-ai-error { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; align-self: flex-start; margin-left: 40px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-radius: 12px; padding: 9px 12px; font-size: 13px; animation: b2y-ai-in 0.2s ease-out; }
|
|
112
|
+
.b2y-ai-error span { flex: 1; min-width: 160px; }
|
|
113
|
+
.b2y-ai-error button { border: 1px solid #fca5a5; background: #fff; color: inherit; border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 12px; font-weight: 500; }
|
|
114
|
+
.b2y-ai-error button:hover:not(:disabled) { background: #fee2e2; }
|
|
115
|
+
|
|
116
|
+
/* Composer */
|
|
117
|
+
.b2y-ai-composer { padding: 10px 16px 12px; border-top: 1px solid var(--_border); background: var(--_bg); }
|
|
118
|
+
.b2y-ai-input { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--_border); border-radius: 14px; padding: 6px 6px 6px 14px; background: var(--_bg); transition: border-color 0.15s, box-shadow 0.15s; }
|
|
119
|
+
.b2y-ai-input:focus-within { border-color: var(--_accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--_accent) 18%, transparent); }
|
|
120
|
+
.b2y-ai-chat .b2y-ai-input textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; padding: 7px 0; font: inherit; color: var(--_text); min-height: 22px; max-height: 160px; field-sizing: content; }
|
|
121
|
+
.b2y-ai-send { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: var(--_accent); color: #fff; border: 0; border-radius: 10px; cursor: pointer; transition: opacity 0.15s, transform 0.15s; }
|
|
122
|
+
.b2y-ai-send:hover:not(:disabled) { transform: translateY(-1px); }
|
|
123
|
+
.b2y-ai-send:disabled { opacity: 0.4; cursor: default; }
|
|
124
|
+
.b2y-ai-hint { margin: 6px 2px 0; font-size: 11px; color: var(--_muted); }
|
|
125
|
+
|
|
126
|
+
/* Typing indicator */
|
|
127
|
+
.b2y-ai-typing { display: inline-flex; gap: 5px; align-items: center; padding: 13px 16px; background: var(--_bg); border: 1px solid var(--_border); border-radius: 6px 18px 18px 18px; }
|
|
128
|
+
.b2y-ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--_accent); opacity: 0.3; animation: b2y-ai-dot 1.3s infinite ease-in-out; }
|
|
129
|
+
.b2y-ai-typing span:nth-child(2) { animation-delay: 0.16s; }
|
|
130
|
+
.b2y-ai-typing span:nth-child(3) { animation-delay: 0.32s; }
|
|
131
|
+
@keyframes b2y-ai-dot { 0%, 70%, 100% { opacity: 0.3; transform: translateY(0) scale(0.9); } 35% { opacity: 1; transform: translateY(-4px) scale(1); } }
|
|
132
|
+
@keyframes b2y-ai-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
|
|
133
|
+
|
|
134
|
+
@media (max-width: 640px) {
|
|
135
|
+
.b2y-ai-chat { border-radius: 14px; }
|
|
136
|
+
.b2y-ai-theme .b2y-ai-row-assistant > .b2y-ai-avatar { display: none; }
|
|
137
|
+
.b2y-ai-title span:not(.b2y-ai-avatar), .b2y-ai-ghost span, .b2y-ai-hint { display: none; }
|
|
138
|
+
.b2y-ai-bubble, .b2y-ai-bubble-user { max-width: 92%; }
|
|
139
|
+
.b2y-ai-row-assistant > .b2y-ai-avatar { display: none; }
|
|
140
|
+
.b2y-ai-error { margin-left: 0; }
|
|
141
|
+
}
|
|
142
|
+
@media (prefers-reduced-motion: reduce) {
|
|
143
|
+
.b2y-ai-typing span { animation: none; opacity: 0.7; }
|
|
144
|
+
.b2y-ai-row, .b2y-ai-empty, .b2y-ai-history, .b2y-ai-error { animation: none; }
|
|
145
|
+
.b2y-ai-messages { scroll-behavior: auto; }
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Item cards (products, listings) */
|
|
149
|
+
.b2y-ai-cards-title { margin: 0 0 8px; font-weight: 600; }
|
|
150
|
+
.b2y-ai-cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(140px, 160px); gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; padding: 2px 2px 8px; scrollbar-width: thin; }
|
|
151
|
+
.b2y-ai-item { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 8px 8px 10px; border: 1px solid var(--_border); border-radius: 12px; background: var(--_bg); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; scroll-snap-align: start; }
|
|
152
|
+
a.b2y-ai-item:hover { border-color: var(--_accent); box-shadow: 0 4px 14px rgba(0, 0, 0, .08); transform: translateY(-1px); }
|
|
153
|
+
a.b2y-ai-item:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }
|
|
154
|
+
.b2y-ai-item-image { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--_surface); margin-bottom: 4px; }
|
|
155
|
+
.b2y-ai-item-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
|
|
156
|
+
.b2y-ai-item-image-empty { display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 600; color: var(--_accent); background: var(--_accent-soft); }
|
|
157
|
+
.b2y-ai-item-badge { position: absolute; top: 12px; left: 12px; padding: 2px 8px; border-radius: 999px; background: var(--_accent); color: #fff; font-size: 11px; font-weight: 600; }
|
|
158
|
+
.b2y-ai-item-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
159
|
+
.b2y-ai-item-subtitle { font-size: 12px; color: var(--_muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
160
|
+
.b2y-ai-item-price { font-size: 14px; font-weight: 700; margin-top: 2px; }
|
|
161
|
+
.b2y-ai-item-price s { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--_muted); }
|
|
162
|
+
|
|
163
|
+
/* Floating widget: launcher button and chat panel (bottom right; full screen on phones) */
|
|
164
|
+
.b2y-ai-widget { --b2y-ai-height: 100%; }
|
|
165
|
+
.b2y-ai-launcher { position: fixed; z-index: 61; right: 24px; bottom: 24px; display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--b2y-ai-accent, #4f46e5); color: #fff; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.2); transition: transform 0.15s, box-shadow 0.15s; }
|
|
166
|
+
.b2y-ai-launcher:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(16, 24, 40, 0.24); }
|
|
167
|
+
.b2y-ai-launcher:focus-visible { outline: 2px solid var(--b2y-ai-accent, #4f46e5); outline-offset: 3px; }
|
|
168
|
+
.b2y-ai-launcher-open { width: 56px; padding: 0; justify-content: center; }
|
|
169
|
+
.b2y-ai-launcher-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-left: -10px; border-radius: 999px; background: #fff; color: #1f2937; }
|
|
170
|
+
.b2y-ai-launcher-dot { position: absolute; top: 0; right: 0; width: 9px; height: 9px; border-radius: 999px; background: #4ade80; box-shadow: 0 0 0 2px var(--b2y-ai-accent, #4f46e5); }
|
|
171
|
+
.b2y-ai-widget-panel { position: fixed; z-index: 60; right: 24px; bottom: 96px; width: min(420px, calc(100vw - 32px)); height: min(640px, calc(100vh - 128px)); border-radius: 18px; box-shadow: 0 24px 64px rgba(16, 24, 40, 0.24); animation: b2y-ai-in 0.18s ease-out; }
|
|
172
|
+
.b2y-ai-widget-panel .b2y-ai-chat { height: 100%; min-height: 0; }
|
|
173
|
+
.b2y-ai-widget-close { display: none; position: absolute; z-index: 2; top: 14px; right: 12px; padding: 6px; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }
|
|
174
|
+
@media (max-width: 640px) {
|
|
175
|
+
.b2y-ai-widget-panel { inset: 0; width: 100%; height: 100%; border-radius: 0; }
|
|
176
|
+
.b2y-ai-widget-panel .b2y-ai-chat { border-radius: 0; }
|
|
177
|
+
.b2y-ai-widget-panel .b2y-ai-header { padding-right: 52px; }
|
|
178
|
+
.b2y-ai-widget-close { display: inline-flex; }
|
|
179
|
+
.b2y-ai-launcher-open { display: none; }
|
|
180
|
+
.b2y-ai-launcher { right: 16px; bottom: 16px; }
|
|
181
|
+
}
|
|
182
|
+
@media (prefers-reduced-motion: reduce) { .b2y-ai-launcher, .b2y-ai-widget-panel { transition: none; animation: none; } }
|
|
183
|
+
|
|
184
|
+
/* Beya's bot icon: teal accents everywhere; on the launcher it tilts, blinks and its signal pulses */
|
|
185
|
+
.b2y-ai-bot-accent, .b2y-ai-bot-signal { stroke: var(--b2y-ai-icon-accent, #2ec4b6); }
|
|
186
|
+
.b2y-ai-launcher .b2y-ai-bot { animation: b2y-ai-bot-tilt 4s ease-in-out infinite; transform-origin: 50% 70%; }
|
|
187
|
+
.b2y-ai-launcher .b2y-ai-bot-signal { animation: b2y-ai-bot-signal 2s ease-in-out infinite; }
|
|
188
|
+
.b2y-ai-launcher .b2y-ai-bot-eyes, .b2y-ai-empty-icon .b2y-ai-bot-eyes { animation: b2y-ai-bot-blink 4.5s infinite; transform-box: fill-box; transform-origin: center; }
|
|
189
|
+
@keyframes b2y-ai-bot-tilt { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-9deg); } 85% { transform: rotate(7deg); } }
|
|
190
|
+
@keyframes b2y-ai-bot-signal { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
|
|
191
|
+
@keyframes b2y-ai-bot-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.15); } }
|
|
192
|
+
@media (prefers-reduced-motion: reduce) { .b2y-ai-bot, .b2y-ai-bot * { animation: none !important; } }
|
|
193
|
+
|
|
194
|
+
/* Page layout (variant="page"): conversations sidebar, title bar, conversation and composer */
|
|
195
|
+
.b2y-ai-page { display: grid; grid-template-columns: 0 minmax(0, 1fr); flex-direction: unset; height: var(--b2y-ai-height, calc(100vh - 120px)); min-height: 460px; overflow: hidden; }
|
|
196
|
+
.b2y-ai-page.b2y-ai-sidebar-open { grid-template-columns: 264px minmax(0, 1fr); }
|
|
197
|
+
.b2y-ai-sidebar { display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; padding: 16px 12px; overflow: hidden; background: var(--_surface); border-right: 1px solid var(--_border); }
|
|
198
|
+
.b2y-ai-page:not(.b2y-ai-sidebar-open) .b2y-ai-sidebar { visibility: hidden; padding: 0; border: 0; }
|
|
199
|
+
.b2y-ai-new-chat { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--_border); border-radius: 10px; background: var(--_bg); color: var(--_text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); transition: border-color 0.15s, color 0.15s; }
|
|
200
|
+
.b2y-ai-new-chat:hover:not(:disabled) { border-color: var(--_accent); color: var(--_accent); }
|
|
201
|
+
.b2y-ai-sidebar-label { margin: 18px 8px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--_muted); }
|
|
202
|
+
.b2y-ai-conversations { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
|
|
203
|
+
.b2y-ai-conversation { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--_text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; transition: background 0.15s; }
|
|
204
|
+
.b2y-ai-conversation span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
205
|
+
.b2y-ai-conversation svg { flex-shrink: 0; color: var(--_muted); }
|
|
206
|
+
.b2y-ai-conversation:hover:not(:disabled) { background: var(--_bg); }
|
|
207
|
+
.b2y-ai-conversation.b2y-ai-active { background: var(--_accent-soft); font-weight: 600; }
|
|
208
|
+
.b2y-ai-conversation.b2y-ai-active svg { color: var(--_accent); }
|
|
209
|
+
.b2y-ai-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--_bg); }
|
|
210
|
+
.b2y-ai-page-header { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px; border-bottom: 1px solid var(--_border); }
|
|
211
|
+
.b2y-ai-icon-button { display: inline-flex; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--_muted); cursor: pointer; }
|
|
212
|
+
.b2y-ai-icon-button:hover { background: var(--_surface); color: var(--_text); }
|
|
213
|
+
.b2y-ai-page-mark { display: inline-flex; color: var(--_accent); }
|
|
214
|
+
.b2y-ai-page-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
|
|
215
|
+
.b2y-ai-page .b2y-ai-messages { padding: 24px max(16px, calc((100% - 820px) / 2)); }
|
|
216
|
+
.b2y-ai-page .b2y-ai-row-user { align-items: flex-start; }
|
|
217
|
+
.b2y-ai-page .b2y-ai-bubble-user { background: var(--_surface); color: var(--_text); border: 1px solid var(--_border); box-shadow: none; }
|
|
218
|
+
.b2y-ai-user-avatar { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--_surface); border: 1px solid var(--_border); color: var(--_muted); }
|
|
219
|
+
.b2y-ai-page .b2y-ai-row-assistant > .b2y-ai-avatar { background: var(--_accent); border: 0; color: #fff; }
|
|
220
|
+
.b2y-ai-page .b2y-ai-row-assistant > .b2y-ai-avatar .b2y-ai-bot-accent,
|
|
221
|
+
.b2y-ai-page .b2y-ai-row-assistant > .b2y-ai-avatar .b2y-ai-bot-signal { stroke: #fff; }
|
|
222
|
+
.b2y-ai-page .b2y-ai-row-assistant .b2y-ai-bubble { padding: 5px 0 0; background: transparent; border: 0; box-shadow: none; }
|
|
223
|
+
.b2y-ai-page .b2y-ai-composer { padding: 8px max(16px, calc((100% - 820px) / 2)) 14px; border-top: 0; }
|
|
224
|
+
.b2y-ai-page .b2y-ai-input { padding: 8px 8px 8px 16px; border-radius: 16px; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06); }
|
|
225
|
+
.b2y-ai-page .b2y-ai-send { border-radius: 999px; }
|
|
226
|
+
.b2y-ai-page .b2y-ai-hint { text-align: center; }
|
|
227
|
+
.b2y-ai-scrim { display: none; }
|
|
228
|
+
@media (max-width: 767px) {
|
|
229
|
+
.b2y-ai-page, .b2y-ai-page.b2y-ai-sidebar-open { grid-template-columns: minmax(0, 1fr); }
|
|
230
|
+
.b2y-ai-page .b2y-ai-sidebar { position: absolute; z-index: 6; inset: 0 auto 0 0; width: min(280px, 85%); padding: 16px 12px; border-right: 1px solid var(--_border); visibility: visible; transform: translateX(-100%); transition: transform 0.2s ease; }
|
|
231
|
+
.b2y-ai-page.b2y-ai-sidebar-open .b2y-ai-sidebar { transform: none; box-shadow: 12px 0 32px rgba(16, 24, 40, 0.18); }
|
|
232
|
+
.b2y-ai-page.b2y-ai-sidebar-open .b2y-ai-scrim { display: block; position: absolute; z-index: 5; inset: 0; background: rgba(15, 23, 42, 0.35); }
|
|
233
|
+
.b2y-ai-page .b2y-ai-messages { padding: 16px 12px; }
|
|
234
|
+
.b2y-ai-page .b2y-ai-composer { padding: 8px 12px 12px; }
|
|
235
|
+
.b2y-ai-page .b2y-ai-user-avatar { display: none; }
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* Applications' global form styles (for example dark-mode inputs) must not restyle the composer */
|
|
239
|
+
.b2y-ai-chat .b2y-ai-input textarea, .b2y-ai-chat .b2y-ai-input textarea:focus { background: transparent; border: 0; box-shadow: none; color: inherit; }
|