vpschatbotwidget 1.0.2 → 1.1.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.
Files changed (42) hide show
  1. package/dist-lib/types/App.d.ts +1 -0
  2. package/dist-lib/types/chatbot/api/chatbot-api.d.ts +10 -2
  3. package/dist-lib/types/chatbot/api/chatbot-types.d.ts +21 -0
  4. package/dist-lib/types/chatbot/core/AgentReasoning.d.ts +9 -0
  5. package/dist-lib/types/chatbot/core/ChatContext.d.ts +2 -0
  6. package/dist-lib/types/chatbot/core/ChatMarkdown.d.ts +2 -2
  7. package/dist-lib/types/chatbot/core/ChatProvider.d.ts +13 -1
  8. package/dist-lib/types/chatbot/core/ChatTypingIndicator.d.ts +1 -0
  9. package/dist-lib/types/chatbot/core/GroundedSources.d.ts +14 -0
  10. package/dist-lib/types/chatbot/embedded/EmbeddedChatbot.d.ts +13 -1
  11. package/dist-lib/types/chatbot/index.d.ts +1 -1
  12. package/dist-lib/types/chatbot/widget/ChatbotWidget.d.ts +13 -1
  13. package/dist-lib/vps-chatbot.cjs +32 -28
  14. package/dist-lib/vps-chatbot.js +1262 -1085
  15. package/package.json +2 -2
  16. package/src/chatbot/api/chatbot-api.ts +105 -3
  17. package/src/chatbot/api/chatbot-types.ts +23 -0
  18. package/src/chatbot/core/AgentReasoning.tsx +60 -0
  19. package/src/chatbot/core/ChatContext.tsx +2 -0
  20. package/src/chatbot/core/ChatEmptyState.tsx +4 -4
  21. package/src/chatbot/core/ChatError.tsx +2 -2
  22. package/src/chatbot/core/ChatHeader.tsx +13 -13
  23. package/src/chatbot/core/ChatInput.tsx +6 -6
  24. package/src/chatbot/core/ChatMarkdown.tsx +280 -55
  25. package/src/chatbot/core/ChatMessage.tsx +53 -62
  26. package/src/chatbot/core/ChatMessageList.tsx +1 -1
  27. package/src/chatbot/core/ChatPanel.tsx +2 -6
  28. package/src/chatbot/core/ChatProvider.tsx +109 -22
  29. package/src/chatbot/core/ChatSuggestions.tsx +5 -10
  30. package/src/chatbot/core/ChatTicketConfirmation.tsx +9 -9
  31. package/src/chatbot/core/ChatTypingIndicator.tsx +16 -5
  32. package/src/chatbot/core/GroundedSources.tsx +181 -0
  33. package/src/chatbot/embedded/EmbeddedChatbot.tsx +33 -4
  34. package/src/chatbot/embedded/EmbeddedChatbotPanel.tsx +2 -11
  35. package/src/chatbot/embedded/EmbeddedChatbotTrigger.tsx +2 -2
  36. package/src/chatbot/index.ts +1 -0
  37. package/src/chatbot/widget/ChatbotWidget.tsx +33 -4
  38. package/src/chatbot/widget/ChatbotWidgetPanel.tsx +1 -6
  39. package/src/chatbot/widget/ChatbotWidgetTrigger.tsx +1 -8
  40. package/src/components/EnvBadge.tsx +2 -2
  41. package/src/components/ui/message-scroller.tsx +5 -23
  42. package/src/index.css +1998 -51
@@ -1,87 +1,312 @@
1
1
  import React from "react";
2
2
 
3
+ /**
4
+ * Robust inline Markdown renderer supporting:
5
+ * - Markdown links [text](url)
6
+ * - Raw URLs https://...
7
+ * - Bold **text**
8
+ * - Italic *text* and _text_
9
+ * - Inline code `text`
10
+ */
3
11
  function renderInline(text: string): React.ReactNode[] {
4
- const parts = text.split(/(\*\*[^*]+\*\*|`[^`]+`|https?:\/\/[^\s]+)/g);
12
+ if (!text) return [];
13
+
14
+ // Match: [text](url) | **bold** | *italic* | `code` | https?://...
15
+ const tokenRegex =
16
+ /(\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|https?:\/\/[^\s]+)/g;
17
+
18
+ const parts = text.split(tokenRegex);
19
+
5
20
  return parts.map((part, index) => {
6
- if (part.startsWith("**") && part.endsWith("**")) {
7
- return <strong key={index}>{part.slice(2, -2)}</strong>;
8
- }
9
- if (part.startsWith("`") && part.endsWith("`")) {
21
+ if (!part) return null;
22
+
23
+ // Markdown link: [text](url)
24
+ const linkMatch = part.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
25
+ if (linkMatch) {
26
+ const linkText = linkMatch[1];
27
+ const linkUrl = linkMatch[2];
28
+ const isExternal = /^https?:\/\//i.test(linkUrl);
10
29
  return (
11
- <code
30
+ <a
12
31
  key={index}
13
- className="rounded bg-[var(--input-bg)] px-1 py-0.5 font-mono text-[12px] text-foreground"
32
+ href={linkUrl}
33
+ target={isExternal ? "_blank" : undefined}
34
+ rel={isExternal ? "noopener noreferrer" : undefined}
35
+ className="md-link"
14
36
  >
37
+ {linkText}
38
+ </a>
39
+ );
40
+ }
41
+
42
+ // Bold: **text**
43
+ if (part.startsWith("**") && part.endsWith("**") && part.length >= 4) {
44
+ return <strong key={index}>{part.slice(2, -2)}</strong>;
45
+ }
46
+
47
+ // Italic: *text*
48
+ if (part.startsWith("*") && part.endsWith("*") && part.length >= 2) {
49
+ return <em key={index}>{part.slice(1, -1)}</em>;
50
+ }
51
+
52
+ // Inline code: `code`
53
+ if (part.startsWith("`") && part.endsWith("`") && part.length >= 2) {
54
+ return (
55
+ <code key={index} className="md-code">
15
56
  {part.slice(1, -1)}
16
57
  </code>
17
58
  );
18
59
  }
19
- if (/^https?:\/\//.test(part)) {
60
+
61
+ // Raw URL: https://...
62
+ if (/^https?:\/\//i.test(part)) {
20
63
  return (
21
64
  <a
22
65
  key={index}
23
66
  href={part}
24
67
  target="_blank"
25
68
  rel="noopener noreferrer"
26
- className="underline underline-offset-2"
69
+ className="md-link"
27
70
  >
28
71
  {part}
29
72
  </a>
30
73
  );
31
74
  }
75
+
32
76
  return <React.Fragment key={index}>{part}</React.Fragment>;
33
77
  });
34
78
  }
35
79
 
36
- export function ChatMarkdown({ text }: { text: string }) {
37
- if (!text) return null;
80
+ type Block =
81
+ | { type: "h"; level: number; content: string }
82
+ | { type: "p"; lines: string[] }
83
+ | { type: "ul"; items: string[] }
84
+ | { type: "ol"; items: string[] }
85
+ | { type: "code"; lang: string; code: string }
86
+ | { type: "quote"; lines: string[] }
87
+ | { type: "hr" }
88
+ | { type: "table"; headers: string[]; rows: string[][] };
38
89
 
39
- const blocks = text.split(/\n\n+/);
40
- return (
41
- <>
42
- {blocks.map((block, blockIndex) => {
43
- if (block.trim().startsWith("- ") || block.trim().startsWith("* ")) {
44
- const items = block
45
- .split(/\n/)
46
- .filter((line) => line.trim().startsWith("- ") || line.trim().startsWith("* "));
47
- return (
48
- <ul key={blockIndex} className="my-1.5 ml-4 list-disc space-y-0.5">
49
- {items.map((item, itemIndex) => (
50
- <li key={itemIndex}>{renderInline(item.replace(/^[-*]\s+/, ""))}</li>
51
- ))}
52
- </ul>
53
- );
54
- }
90
+ /**
91
+ * Line-by-line block parser for Markdown documents.
92
+ * Correctly distinguishes lists, headers, code fences, blockquotes, and paragraphs.
93
+ */
94
+ function parseBlocks(markdown: string): Block[] {
95
+ const lines = markdown.replace(/\r\n/g, "\n").split("\n");
96
+ const blocks: Block[] = [];
55
97
 
56
- if (/^\d+\.\s+/.test(block.trim())) {
57
- const items = block.split(/\n/).filter((line) => /^\d+\.\s+/.test(line.trim()));
58
- return (
59
- <ol key={blockIndex} className="my-1.5 ml-4 list-decimal space-y-0.5">
60
- {items.map((item, itemIndex) => (
61
- <li key={itemIndex}>{renderInline(item.replace(/^\d+\.\s+/, ""))}</li>
62
- ))}
63
- </ol>
64
- );
65
- }
98
+ let i = 0;
99
+ while (i < lines.length) {
100
+ const rawLine = lines[i];
101
+ const trimmed = rawLine.trim();
66
102
 
67
- if (block.startsWith("```")) {
68
- const content = block.replace(/^```[a-zA-Z]*\n?/, "").replace(/```$/, "");
69
- return (
70
- <pre
71
- key={blockIndex}
72
- className="my-2 overflow-x-auto rounded-lg bg-[var(--code-bg)] p-3 font-mono text-[12px] text-primary-foreground"
73
- >
74
- <code>{content}</code>
75
- </pre>
76
- );
77
- }
103
+ // 1. Skip completely empty lines
104
+ if (!trimmed) {
105
+ i++;
106
+ continue;
107
+ }
78
108
 
79
- return (
80
- <p key={blockIndex} className="mb-2 last:mb-0 whitespace-pre-wrap">
81
- {renderInline(block)}
82
- </p>
83
- );
109
+ // 2. Code blocks (```lang ... ```)
110
+ if (trimmed.startsWith("```")) {
111
+ const lang = trimmed.slice(3).trim();
112
+ const codeLines: string[] = [];
113
+ i++;
114
+ while (i < lines.length && !lines[i].trim().startsWith("```")) {
115
+ codeLines.push(lines[i]);
116
+ i++;
117
+ }
118
+ if (i < lines.length && lines[i].trim().startsWith("```")) {
119
+ i++; // skip closing fence
120
+ }
121
+ blocks.push({ type: "code", lang, code: codeLines.join("\n") });
122
+ continue;
123
+ }
124
+
125
+ // 3. Horizontal rule (--- or ***)
126
+ if (/^(---|___|\*\*\*)$/.test(trimmed)) {
127
+ blocks.push({ type: "hr" });
128
+ i++;
129
+ continue;
130
+ }
131
+
132
+ // 4. Headings (# to ####)
133
+ const headingMatch = trimmed.match(/^(#{1,4})\s+(.*)$/);
134
+ if (headingMatch) {
135
+ blocks.push({
136
+ type: "h",
137
+ level: headingMatch[1].length,
138
+ content: headingMatch[2],
139
+ });
140
+ i++;
141
+ continue;
142
+ }
143
+
144
+ // 5. Blockquote (> ...)
145
+ if (trimmed.startsWith(">")) {
146
+ const quoteLines: string[] = [];
147
+ while (i < lines.length && lines[i].trim().startsWith(">")) {
148
+ quoteLines.push(lines[i].trim().replace(/^>\s?/, ""));
149
+ i++;
150
+ }
151
+ blocks.push({ type: "quote", lines: quoteLines });
152
+ continue;
153
+ }
154
+
155
+ // 6. Unordered list (- or *)
156
+ if (/^[-*]\s+/.test(trimmed)) {
157
+ const items: string[] = [];
158
+ while (i < lines.length && /^[-*]\s+/.test(lines[i].trim())) {
159
+ items.push(lines[i].trim().replace(/^[-*]\s+/, ""));
160
+ i++;
161
+ }
162
+ blocks.push({ type: "ul", items });
163
+ continue;
164
+ }
165
+
166
+ // 7. Ordered list (1. 2. ...)
167
+ if (/^\d+\.\s+/.test(trimmed)) {
168
+ const items: string[] = [];
169
+ while (i < lines.length && /^\d+\.\s+/.test(lines[i].trim())) {
170
+ items.push(lines[i].trim().replace(/^\d+\.\s+/, ""));
171
+ i++;
172
+ }
173
+ blocks.push({ type: "ol", items });
174
+ continue;
175
+ }
176
+
177
+ // 8. Markdown table (| col | col |)
178
+ if (trimmed.startsWith("|") && trimmed.endsWith("|")) {
179
+ const tableLines: string[] = [];
180
+ while (i < lines.length && lines[i].trim().startsWith("|") && lines[i].trim().endsWith("|")) {
181
+ tableLines.push(lines[i].trim());
182
+ i++;
183
+ }
184
+ if (tableLines.length >= 2) {
185
+ const parseRow = (line: string) =>
186
+ line
187
+ .slice(1, -1)
188
+ .split("|")
189
+ .map((c) => c.trim());
190
+ const headers = parseRow(tableLines[0]);
191
+ // line 1 is usually separator (|---|---|)
192
+ const rowStartIndex = tableLines[1].includes("-") ? 2 : 1;
193
+ const rows = tableLines.slice(rowStartIndex).map(parseRow);
194
+ blocks.push({ type: "table", headers, rows });
195
+ continue;
196
+ }
197
+ }
198
+
199
+ // 9. Standard paragraph (accumulate contiguous lines until next empty line or block token)
200
+ const pLines: string[] = [];
201
+ while (
202
+ i < lines.length &&
203
+ lines[i].trim() &&
204
+ !lines[i].trim().startsWith("```") &&
205
+ !/^(#{1,4})\s+/.test(lines[i].trim()) &&
206
+ !/^[-*]\s+/.test(lines[i].trim()) &&
207
+ !/^\d+\.\s+/.test(lines[i].trim()) &&
208
+ !lines[i].trim().startsWith(">") &&
209
+ !/^(---|___|\*\*\*)$/.test(lines[i].trim())
210
+ ) {
211
+ pLines.push(lines[i].trim());
212
+ i++;
213
+ }
214
+ if (pLines.length > 0) {
215
+ blocks.push({ type: "p", lines: pLines });
216
+ }
217
+ }
218
+
219
+ return blocks;
220
+ }
221
+
222
+ export const ChatMarkdown: React.FC<{ text: string }> = ({ text }) => {
223
+ if (!text) return null;
224
+
225
+ const blocks = parseBlocks(text);
226
+
227
+ return (
228
+ <div className="md-content">
229
+ {blocks.map((block, idx) => {
230
+ switch (block.type) {
231
+ case "h": {
232
+ if (block.level === 1) return <h2 key={idx} className="md-h1">{renderInline(block.content)}</h2>;
233
+ if (block.level === 2) return <h3 key={idx} className="md-h2">{renderInline(block.content)}</h3>;
234
+ if (block.level === 3) return <h4 key={idx} className="md-h3">{renderInline(block.content)}</h4>;
235
+ return <h5 key={idx} className="md-h4">{renderInline(block.content)}</h5>;
236
+ }
237
+ case "ul":
238
+ return (
239
+ <ul key={idx} className="md-ul">
240
+ {block.items.map((item, itemIdx) => (
241
+ <li key={itemIdx} className="md-li">
242
+ {renderInline(item)}
243
+ </li>
244
+ ))}
245
+ </ul>
246
+ );
247
+ case "ol":
248
+ return (
249
+ <ol key={idx} className="md-ol">
250
+ {block.items.map((item, itemIdx) => (
251
+ <li key={itemIdx} className="md-li">
252
+ {renderInline(item)}
253
+ </li>
254
+ ))}
255
+ </ol>
256
+ );
257
+ case "code":
258
+ return (
259
+ <pre key={idx} className="md-pre">
260
+ <code>{block.code}</code>
261
+ </pre>
262
+ );
263
+ case "quote":
264
+ return (
265
+ <blockquote key={idx} className="md-quote">
266
+ {block.lines.map((line, qIdx) => (
267
+ <p key={qIdx}>{renderInline(line)}</p>
268
+ ))}
269
+ </blockquote>
270
+ );
271
+ case "hr":
272
+ return <hr key={idx} className="md-hr" />;
273
+ case "table":
274
+ return (
275
+ <div key={idx} className="md-table-wrap">
276
+ <table className="md-table">
277
+ <thead>
278
+ <tr>
279
+ {block.headers.map((h, hIdx) => (
280
+ <th key={hIdx}>{renderInline(h)}</th>
281
+ ))}
282
+ </tr>
283
+ </thead>
284
+ <tbody>
285
+ {block.rows.map((row, rIdx) => (
286
+ <tr key={rIdx}>
287
+ {row.map((cell, cIdx) => (
288
+ <td key={cIdx}>{renderInline(cell)}</td>
289
+ ))}
290
+ </tr>
291
+ ))}
292
+ </tbody>
293
+ </table>
294
+ </div>
295
+ );
296
+ case "p":
297
+ default:
298
+ return (
299
+ <p key={idx} className="md-p">
300
+ {block.lines.map((line, lineIdx) => (
301
+ <React.Fragment key={lineIdx}>
302
+ {renderInline(line)}
303
+ {lineIdx < block.lines.length - 1 && <br />}
304
+ </React.Fragment>
305
+ ))}
306
+ </p>
307
+ );
308
+ }
84
309
  })}
85
- </>
310
+ </div>
86
311
  );
87
- }
312
+ };
@@ -1,9 +1,11 @@
1
- import React, { useState } from "react";
2
- import { Bot, Check, ChevronDown, ChevronUp, FileText , BotMessageSquare} from "lucide-react";
3
- import type { ChatMessage, Source, ToolCall } from "../api/chatbot-types";
4
- import { cn } from "../../lib/cn";
1
+ import React from "react";
2
+ import { Check, BotMessageSquare } from "lucide-react";
3
+ import type { ChatMessage, ToolCall } from "../api/chatbot-types";
5
4
  import { ChatMarkdown } from "./ChatMarkdown";
6
5
  import { ChatTypingIndicator } from "./ChatTypingIndicator";
6
+ import { AgentReasoning } from "./AgentReasoning";
7
+
8
+ import { useOptionalChatContext } from "./ChatContext";
7
9
 
8
10
  function toolLabel(name: string): string {
9
11
  if (name === "create_ticket") return "Support ticket processed";
@@ -12,50 +14,14 @@ function toolLabel(name: string): string {
12
14
  return "Information retrieved";
13
15
  }
14
16
 
15
- function Sources({ sources }: { sources: Source[] }) {
16
- const [open, setOpen] = useState(false);
17
- if (!sources.length) return null;
18
- return (
19
- <div className="mt-2 border-t border-border pt-1.5">
20
- <button
21
- type="button"
22
- className="inline-flex items-center gap-1.5 text-[11.5px] font-semibold text-muted-foreground hover:text-foreground"
23
- onClick={() => setOpen((value) => !value)}
24
- aria-expanded={open}
25
- >
26
- <FileText size={12} aria-hidden="true" />
27
- {sources.length} grounded source{sources.length > 1 ? "s" : ""}
28
- {open ? <ChevronUp size={12} /> : <ChevronDown size={12} />}
29
- </button>
30
- {open && (
31
- <ul className="mt-1.5 space-y-1">
32
- {sources.map((source) => (
33
- <li
34
- key={source.chunkId}
35
- className="flex items-center justify-between rounded-md border border-border bg-muted px-2 py-1 text-[11px] text-muted-foreground"
36
- >
37
- <span className="truncate" title={source.source}>
38
- {source.source.split(/[/\\]/).pop() || source.source}
39
- </span>
40
- <span className="ml-2 font-semibold text-success">
41
- {Math.round(source.score * 100)}%
42
- </span>
43
- </li>
44
- ))}
45
- </ul>
46
- )}
47
- </div>
48
- );
49
- }
50
-
51
17
  function Tools({ toolCalls }: { toolCalls: ToolCall[] }) {
52
18
  if (!toolCalls.length) return null;
53
19
  return (
54
- <div className="mt-2 flex flex-wrap gap-1.5">
20
+ <div className="tool-badges">
55
21
  {toolCalls.map((call, index) => (
56
22
  <span
57
23
  key={`${call.toolName}-${index}`}
58
- className="inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] text-muted-foreground"
24
+ className="tool-badge"
59
25
  >
60
26
  {toolLabel(call.toolName)}
61
27
  </span>
@@ -69,45 +35,70 @@ interface ChatMessageProps {
69
35
  }
70
36
 
71
37
  export const ChatMessageBubble: React.FC<ChatMessageProps> = ({ message }) => {
38
+ const chatCtx = useOptionalChatContext();
39
+ const hideInspectSources = chatCtx?.hideInspectSources ?? false;
40
+ const showGroundedSources = chatCtx?.showGroundedSources ?? true;
41
+
72
42
  const isUser = message.role === "user";
73
43
  const isError = message.status === "error";
44
+ const isPending = message.status === "pending";
45
+ const isWelcome =
46
+ message.id === "welcome-default" ||
47
+ message.id.startsWith("welcome") ||
48
+ message.id === "welcome";
49
+
50
+ // Only actual AI responses with retrieval, tools, or live pending state show the reasoning accordion
51
+ const isRealAssistantQuery = Boolean(
52
+ isPending ||
53
+ (message.sources && message.sources.length > 0) ||
54
+ (message.toolCalls && message.toolCalls.length > 0) ||
55
+ message.usage
56
+ );
57
+ const showReasoning = !isUser && !isError && !isWelcome && isRealAssistantQuery;
74
58
 
75
59
  return (
76
- <div
77
- className={cn("flex items-start gap-2.5", isUser && "flex-row-reverse")}
78
- >
60
+ <div className={`msg-row${isUser ? " msg-row--user" : ""}`}>
79
61
  {!isUser && (
80
62
  <div
81
- className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground"
63
+ className="avatar-circle avatar-circle--mt"
82
64
  aria-hidden="true"
83
65
  >
84
66
  <BotMessageSquare size={15} />
85
67
  </div>
86
68
  )}
87
- <div className={cn("flex max-w-[82%] flex-col", isUser && "items-end")}>
69
+ <div className={`msg-col${isUser ? " msg-col--user" : ""}`}>
88
70
  <div
89
- className={cn(
90
- "rounded-2xl px-3.5 py-2.5 text-[13.5px] leading-[1.55]",
91
- isUser && "rounded-tr-sm bg-[var(--bubble-user-bg)] text-[var(--bubble-user-text)] font-medium",
92
- !isUser &&
93
- !isError &&
94
- "rounded-tl-sm border border-border bg-[var(--bubble-bot-message-bg)] text-foreground",
95
- isError &&
96
- "rounded-tl-sm border border-[var(--error-border)] bg-[var(--error-bg)] text-[var(--error-text)]"
97
- )}
71
+ className={
72
+ isUser
73
+ ? "msg-bubble msg-bubble--user"
74
+ : isError
75
+ ? "msg-bubble msg-bubble--error"
76
+ : "msg-bubble msg-bubble--bot"
77
+ }
98
78
  >
99
- {message.status === "pending" ? (
100
- <ChatTypingIndicator />
79
+ {/* Agent Reasoning Accordion (ChatGPT / Open WebUI style) only on real queries */}
80
+ {showReasoning && (
81
+ <AgentReasoning
82
+ status={isPending ? "pending" : "complete"}
83
+ progressText={message.progressText}
84
+ sourcesCount={message.sources?.length || 5}
85
+ />
86
+ )}
87
+
88
+ {isPending ? (
89
+ <ChatTypingIndicator text={message.progressText} />
101
90
  ) : isUser ? (
102
- <p className="whitespace-pre-wrap">{message.content}</p>
91
+ <p className="msg-user-pre">{message.content}</p>
103
92
  ) : (
104
- <ChatMarkdown text={message.content} />
93
+ <div className="msg-content-wrapper">
94
+ <ChatMarkdown text={message.content} />
95
+ </div>
105
96
  )}
97
+
106
98
  {message.toolCalls ? <Tools toolCalls={message.toolCalls} /> : null}
107
- {message.sources ? <Sources sources={message.sources} /> : null}
108
99
  </div>
109
100
  {isUser && message.status !== "error" && (
110
- <Check size={13} className="mt-1 text-success" aria-hidden="true" />
101
+ <Check size={13} className="msg-tick" aria-hidden="true" />
111
102
  )}
112
103
  </div>
113
104
  </div>
@@ -24,7 +24,7 @@ export const ChatMessageList: React.FC = () => {
24
24
  <MessageScroller>
25
25
  <MessageScrollerViewport aria-label="Chat messages">
26
26
  <MessageScrollerContent aria-busy={isBusy}>
27
- {showSuggestions && (
27
+ {messages.length === 0 && (
28
28
  <MessageScrollerItem messageId="welcome">
29
29
  <ChatEmptyState />
30
30
  </MessageScrollerItem>
@@ -5,7 +5,6 @@ import { ChatHeader } from "./ChatHeader";
5
5
  import { ChatInput } from "./ChatInput";
6
6
  import { ChatMessageList } from "./ChatMessageList";
7
7
  import { ChatTicketConfirmation } from "./ChatTicketConfirmation";
8
- import { cn } from "../../lib/cn";
9
8
  import { type EnvStage } from "../../components/EnvBadge";
10
9
 
11
10
  interface ChatPanelProps {
@@ -35,10 +34,7 @@ export const ChatPanel: React.FC<ChatPanelProps> = ({
35
34
 
36
35
  return (
37
36
  <section
38
- className={cn(
39
- "flex h-full min-h-0 flex-col overflow-hidden bg-card",
40
- className
41
- )}
37
+ className={`chat-panel${className ? ` ${className}` : ""}`}
42
38
  aria-label="VPS AI Assistant"
43
39
  >
44
40
  <ChatHeader
@@ -50,7 +46,7 @@ export const ChatPanel: React.FC<ChatPanelProps> = ({
50
46
  envStage={envStage}
51
47
  envPulse={envPulse}
52
48
  />
53
- <div className="relative min-h-0 flex-1">
49
+ <div className="chat-panel-body">
54
50
  <ChatMessageList />
55
51
  </div>
56
52
  {error && status === "error" && (