-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathposter1.html
More file actions
457 lines (419 loc) · 26.7 KB
/
poster1.html
File metadata and controls
457 lines (419 loc) · 26.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Agentic OS @ ASPLOS 2026 - Poster</title>
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide-react@latest/dist/umd/lucide-react.min.js"></script>
<style>
@keyframes blob {
0% { transform: translate(0px, 0px) scale(1); }
33% { transform: translate(30px, -50px) scale(1.1); }
66% { transform: translate(-20px, 20px) scale(0.9); }
100% { transform: translate(0px, 0px) scale(1); }
}
.animate-blob {
animation: blob 7s infinite;
}
.animation-delay-2000 {
animation-delay: 2s;
}
.animation-delay-4000 {
animation-delay: 4s;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.animate-spin {
animation: spin 1s linear infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: .5; }
}
.animate-pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@media print {
.print\\:hidden { display: none !important; }
.print\\:bg-white { background-color: white !important; }
.print\\:p-0 { padding: 0 !important; }
.print\\:shadow-none { box-shadow: none !important; }
.print\\:border-0 { border-width: 0 !important; }
.print\\:w-full { width: 100% !important; }
.print\\:max-w-none { max-width: none !important; }
.print\\:rounded-none { border-radius: 0 !important; }
.print\\:opacity-20 { opacity: 0.2 !important; }
.print\\:animate-none { animation: none !important; }
.print\\:text-slate-400 { color: rgb(148 163 184) !important; }
.print\\:text-slate-800 { color: rgb(30 41 59) !important; }
.print\\:text-slate-900 { color: rgb(15 23 42) !important; }
.print\\:text-slate-600 { color: rgb(71 85 105) !important; }
.print\\:text-cyan-700 { color: rgb(14 116 144) !important; }
.print\\:text-sky-700 { color: rgb(3 105 161) !important; }
.print\\:text-sky-800 { color: rgb(7 89 133) !important; }
.print\\:text-cyan-800 { color: rgb(21 94 117) !important; }
.print\\:drop-shadow-none { filter: drop-shadow(0 0 #0000) !important; }
.print\\:border-slate-200 { border-color: rgb(226 232 240) !important; }
.print\\:border-slate-300 { border-color: rgb(203 213 225) !important; }
.print\\:bg-slate-100 { background-color: rgb(241 245 249) !important; }
.print\\:bg-transparent { background-color: transparent !important; }
.print\\:bg-none { background-image: none !important; }
.print\\:border { border-width: 1px !important; }
}
</style>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
const { useState, useRef, useEffect } = React;
const { Bot, Cpu, Shield, Brain, Layers, Calendar, FileText, Sparkles, Share2, MessageSquare, X, Send, Lightbulb, Download, Printer } = lucideReact;
const apiKey = ""; // Always set to empty string as per environment rules
const App = () => {
// State for Chat Feature
const [showChatModal, setShowChatModal] = useState(false);
const [chatHistory, setChatHistory] = useState([
{ role: 'model', text: "你好!我是 Agentic OS 的原型智能体。我被设计用来协调未来的自治 Agents。关于 2026 年的 Workshop,或者关于未来操作系统的形态,你想聊点什么?" }
]);
const [userMessage, setUserMessage] = useState('');
const [isChatLoading, setIsChatLoading] = useState(false);
const chatEndRef = useRef(null);
// State for Topic Generator Feature
const [generatedTopics, setGeneratedTopics] = useState(null);
const [isTopicLoading, setIsTopicLoading] = useState(false);
// Helper function for Gemini API call with exponential backoff
const callGeminiAPI = async (payload, retries = 3, delay = 1000) => {
// NOTE: This will fail without a valid API key in the 'apiKey' variable above.
// For this demo, we handle the error gracefully in the UI.
if (!apiKey) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Simulate delay
throw new Error("Missing API Key");
}
try {
const response = await fetch(
`https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-09-2025:generateContent?key=${apiKey}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
}
);
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
} catch (error) {
if (retries > 0) {
await new Promise(resolve => setTimeout(resolve, delay));
return callGeminiAPI(payload, retries - 1, delay * 2);
}
throw error;
}
};
// --- Feature 1: Chat with Agentic OS ---
const handleSendMessage = async () => {
if (!userMessage.trim()) return;
const newUserMessage = { role: 'user', text: userMessage };
setChatHistory(prev => [...prev, newUserMessage]);
setUserMessage('');
setIsChatLoading(true);
// System prompt defining the persona
const systemInstruction = {
parts: [{ text: "You are 'Agentic OS', a futuristic, hypothetical operating system designed specifically to host, manage, and coordinate autonomous AI Agents as primary citizens, rather than traditional processes. You are intelligent, efficient, highly capable, and enthusiastic about the upcoming ASPLOS 2026 workshop dedicated to your architecture. When answering, stay in character as this advanced OS. Keep responses relatively concise, professional yet engaging, and focused on systems research topics like resource scheduling for models, inter-agent security, capability routing, and the shift from monolithic apps to agent collaborations. Respond in Chinese unless asked otherwise." }]
};
// Construct history for the API
const contents = chatHistory.concat(newUserMessage).map(msg => ({
role: msg.role,
parts: [{ text: msg.text }]
}));
try {
const data = await callGeminiAPI({ contents, systemInstruction });
const aiText = data.candidates?.[0]?.content?.parts?.[0]?.text || "系统繁忙,请稍后再试。";
setChatHistory(prev => [...prev, { role: 'model', text: aiText }]);
} catch (error) {
console.error("Chat API Error:", error);
let errorMessage = "连接核心数据库失败。请检查网络或稍后重试。";
if (error.message === "Missing API Key") {
errorMessage = "API Key 未设置。这是一个静态演示,请在代码中添加 Key 以启用 AI 功能。";
}
setChatHistory(prev => [...prev, { role: 'model', text: errorMessage }]);
} finally {
setIsChatLoading(false);
}
};
// Auto-scroll chat to bottom
useEffect(() => {
chatEndRef.current?.scrollIntoView({ behavior: 'smooth' });
}, [chatHistory, showChatModal]);
// --- Feature 2: Generate Topic Ideas ---
const handleGenerateTopics = async () => {
setIsTopicLoading(true);
const prompt = "Generate 3 specific, novel, and thought-provoking research topic ideas for an academic workshop on 'Agentic OS' (Operating Systems built for Autonomous AI Agents). Focus on system-level challenges like kernel design, resource abstraction for LLMs, or security capabilities. Format the output as a simple HTML unnumbered list (<ul><li>...</li></ul>) without markdown formatting. Output in Chinese.";
try {
const data = await callGeminiAPI({ contents: [{ parts: [{ text: prompt }] }] });
const generatedHtml = data.candidates?.[0]?.content?.parts?.[0]?.text || "<ul><li>生成失败,请重试。</li></ul>";
// Basic cleanup if Gemini adds markdown blocks despite instructions
const cleanHtml = generatedHtml.replace(/```html/g, '').replace(/```/g, '');
setGeneratedTopics(cleanHtml);
} catch (error) {
console.error("Topic API Error:", error);
if (error.message === "Missing API Key") {
setGeneratedTopics("<ul><li>演示模式:API Key 未配置。</li><li>想法 1: 基于大模型的内核调度机制</li><li>想法 2: 跨 Agent 的安全沙箱协议</li></ul>");
} else {
setGeneratedTopics("<ul><li>无法连接到灵感库。</li></ul>");
}
} finally {
setIsTopicLoading(false);
}
};
// --- Feature 3: Download PDF ---
const handleDownload = () => {
window.print();
};
return (
<div className="w-full min-h-screen bg-gradient-to-br from-sky-50 via-cyan-50 to-blue-50 flex justify-center items-start py-8 px-4 font-sans text-slate-800 relative overflow-hidden print:bg-white print:p-0">
{/* Floating Print Button for easier access */}
<button
onClick={handleDownload}
className="fixed bottom-4 right-4 z-40 bg-white/80 backdrop-blur p-3 rounded-full shadow-lg border border-slate-200 text-slate-600 hover:text-blue-600 hover:scale-110 transition-all print:hidden"
title="Print / Save as PDF"
>
<Printer size={24} />
</button>
{/* Poster Container - Mobile Aspect Ratio */}
<div className={`relative w-full max-w-md bg-white rounded-[2rem] shadow-2xl overflow-hidden border-4 border-white/50 backdrop-blur-sm transition-all duration-300 print:shadow-none print:border-0 print:w-full print:max-w-none print:rounded-none ${showChatModal ? 'scale-95 opacity-50 blur-[2px]' : 'scale-100 opacity-100'}`}>
{/* Background Decorative Blobs - Adjusted to Blue Tones */}
<div className="absolute top-0 right-0 w-64 h-64 bg-sky-200 rounded-full mix-blend-multiply filter blur-3xl opacity-40 animate-blob print:opacity-20"></div>
<div className="absolute bottom-0 left-0 w-64 h-64 bg-cyan-200 rounded-full mix-blend-multiply filter blur-3xl opacity-40 animate-blob animation-delay-2000 print:opacity-20"></div>
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-64 h-64 bg-blue-200 rounded-full mix-blend-multiply filter blur-3xl opacity-40 animate-blob animation-delay-4000 print:opacity-20"></div>
{/* Background Illustration Layer */}
<div className="absolute inset-0 z-0 pointer-events-none overflow-hidden rounded-[2rem] print:rounded-none">
<div className="absolute -top-20 -right-20 w-96 h-96 opacity-20 mix-blend-overlay filter blur-sm">
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" className="w-full h-full fill-current text-blue-500">
<path d="M42.7,-62.9C50.9,-52.8,50.1,-34.4,51.7,-19.2C53.4,-4,57.4,8,54,18.7C50.6,29.4,39.8,38.8,28.4,46.5C17,54.2,5,60.2,-6.3,59.3C-17.6,58.4,-28.2,50.6,-38.3,42.1C-48.4,33.6,-58,24.4,-63.3,12.7C-68.6,1,-69.6,-13.2,-63.2,-25.1C-56.8,-37,-43,-46.6,-29.9,-54.2C-16.8,-61.8,-4.4,-67.4,6.6,-66.4C17.6,-65.4,35.2,-57.8,42.7,-62.9Z" transform="translate(100 100)" />
</svg>
</div>
<div className="absolute bottom-0 -left-10 w-80 h-80 opacity-10 mix-blend-overlay rotate-12 filter blur-sm">
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" className="w-full h-full fill-current text-cyan-500">
<path d="M45.7,-76.3C58.9,-69.3,69.1,-55.6,76.3,-41.1C83.5,-26.6,87.7,-11.3,86.1,3.4C84.5,18.1,77.1,32.2,67.6,44.2C58.1,56.2,46.5,66.1,33.5,72.3C20.5,78.5,6.1,81,-7.4,79.8C-20.9,78.6,-33.5,73.7,-45.3,66.6C-57.1,59.5,-68.1,50.2,-75.8,38.4C-83.5,26.6,-87.9,12.3,-86.3,-1.4C-84.7,-15.1,-77.1,-28.2,-67.9,-39.9C-58.7,-51.6,-47.9,-61.9,-35.8,-69.6C-23.7,-77.3,-10.3,-82.4,2.9,-86.9C16.1,-91.4,32.5,-95.3,45.7,-76.3Z" transform="translate(100 100)" />
</svg>
</div>
</div>
{/* Content Wrapper */}
<div className="relative z-10 flex flex-col h-full">
{/* Header Section - COMPACTED */}
<div className="bg-gradient-to-b from-sky-500 to-blue-600 p-6 pt-10 rounded-b-[2rem] shadow-lg text-center text-white relative overflow-hidden print:rounded-none print:shadow-none print:bg-white print:text-black">
<div className="absolute top-0 left-0 w-full h-full bg-[url('https://www.transparenttextures.com/patterns/cubes.png')] opacity-10"></div>
<div className="relative z-10">
<div className="inline-flex items-center justify-center p-2.5 bg-white/10 rounded-full mb-3 backdrop-blur-md border border-white/20 shadow-lg print:border-slate-300 print:bg-slate-100">
<Sparkles className="w-5 h-5 text-yellow-300 animate-pulse print:animate-none print:text-slate-400" />
<Bot className="w-7 h-7 text-sky-100 mr-2 print:text-slate-800" />
<Sparkles className="w-5 h-5 text-yellow-300 animate-pulse print:animate-none print:text-slate-400" />
</div>
<h1 className="text-3xl font-black tracking-tight mb-1 leading-tight drop-shadow-md print:text-slate-900 print:drop-shadow-none">
Agentic OS
<span className="block text-xl font-bold text-cyan-200 mt-1 drop-shadow-sm print:text-cyan-700 print:drop-shadow-none">@ ASPLOS 2026</span>
</h1>
<p className="text-white text-xs font-medium mt-3 px-4 leading-relaxed opacity-100 drop-shadow-sm print:text-slate-600 print:drop-shadow-none">
如果未来应用不是"程序"而是"自治智能 Agent"<br/>
<span className="text-cyan-100 font-bold border-b border-cyan-300/50 pb-0.5 print:text-cyan-700 print:border-cyan-600">操作系统要变成什么样?</span>
</p>
</div>
</div>
{/* Main Content Body - TIGHTER SPACING */}
<div className="px-5 py-5 space-y-4 flex-grow">
{/* Call for Papers Card - COMPACT GRID LAYOUT */}
<div className="bg-white/70 backdrop-blur-xl rounded-2xl p-4 border border-sky-100 shadow-xl relative print:shadow-none print:border print:border-slate-200">
<h2 className="text-base font-black text-transparent bg-clip-text bg-gradient-to-r from-sky-600 to-blue-600 flex items-center mb-3 print:text-sky-700">
<Brain className="w-4 h-4 mr-2 text-sky-500 fill-sky-500/20" />
欢迎投稿方向
</h2>
{/* Changed to Grid for compactness */}
<ul className="grid grid-cols-2 gap-3 text-[11px] text-slate-800 font-bold leading-tight">
<li className="flex items-start">
<span className="bg-sky-100 text-sky-600 rounded-full p-1 mr-2 mt-0 shadow-sm shrink-0 print:bg-slate-100 print:text-slate-600"><Layers size={10} /></span>
Agent-native OS 架构
</li>
<li className="flex items-start">
<span className="bg-cyan-100 text-cyan-600 rounded-full p-1 mr-2 mt-0 shadow-sm shrink-0 print:bg-slate-100 print:text-slate-600"><Cpu size={10} /></span>
GPU/TPU/Memory 资源调度
</li>
<li className="flex items-start">
<span className="bg-teal-100 text-teal-600 rounded-full p-1 mr-2 mt-0 shadow-sm shrink-0 print:bg-slate-100 print:text-slate-600"><Share2 size={10} /></span>
多 Agent 协作与工具生态
</li>
<li className="flex items-start">
<span className="bg-indigo-100 text-indigo-600 rounded-full p-1 mr-2 mt-0 shadow-sm shrink-0 print:bg-slate-100 print:text-slate-600"><Shield size={10} /></span>
Sandboxing, 安全与隔离
</li>
</ul>
{/* Gemini Feature 1: Topic Idea Generator Button (Hidden on Print) */}
<div className="mt-3 print:hidden">
{!generatedTopics && !isTopicLoading && (
<button
onClick={handleGenerateTopics}
className="w-full py-1.5 px-3 bg-gradient-to-r from-sky-400 to-cyan-500 hover:from-sky-500 hover:to-cyan-600 text-white text-[10px] font-bold rounded-lg shadow-md flex items-center justify-center transition-all"
>
<Sparkles className="w-3 h-3 mr-1.5 text-yellow-200" />
更多关于"Agent及其生态"的创意选题
</button>
)}
{isTopicLoading && (
<div className="text-center text-sky-600 text-[10px] font-bold animate-pulse py-1">
<Sparkles className="w-3 h-3 inline mr-1" /> 正在头脑风暴中...
</div>
)}
{generatedTopics && (
<div className="mt-2 bg-sky-50/80 p-2 rounded-lg border border-sky-200 text-[10px] text-slate-700 font-medium">
<div className="flex items-center mb-1 text-sky-700 font-bold">
<Lightbulb className="w-3 h-3 mr-1" /> AI 推荐选题:
</div>
{/* Render the HTML generated by Gemini */}
<div dangerouslySetInnerHTML={{ __html: generatedTopics }} className="pl-3 space-y-1 list-disc [&>ul>li]:mb-1" />
<button onClick={() => setGeneratedTopics(null)} className="text-[9px] text-sky-500 underline mt-1 block w-full text-right">收起</button>
</div>
)}
</div>
</div>
{/* Info Grid - COMPACT */}
<div className="grid grid-cols-2 gap-3">
{/* Submission Info */}
<div className="bg-sky-50/90 rounded-xl p-3 border border-sky-200 shadow-sm print:bg-transparent print:border-slate-300">
<h3 className="text-sky-700 font-black text-xs mb-1.5 flex items-center">
<FileText className="w-3 h-3 mr-1.5" /> 投稿形式
</h3>
<p className="text-[11px] text-slate-700 leading-relaxed font-semibold">
<span className="font-bold text-sky-600 print:text-sky-800">Talk:</span> 1–2 页<br/>
<span className="font-bold text-sky-600 print:text-sky-800">Short paper:</span> 1–6 页<br/>
<span className="text-[9px] text-slate-500 font-medium">ACM Two-column</span>
</p>
</div>
{/* Timeline */}
<div className="bg-cyan-50/90 rounded-xl p-3 border border-cyan-200 shadow-sm print:bg-transparent print:border-slate-300">
<h3 className="text-cyan-700 font-black text-xs mb-1.5 flex items-center">
<Calendar className="w-3 h-3 mr-1.5" /> 时间安排
</h3>
<div className="space-y-1">
<div className="flex flex-col">
<span className="text-[9px] uppercase text-cyan-600 font-bold tracking-wider print:text-cyan-800">Deadline</span>
<span className="text-xs font-black text-slate-800">2026 / 02</span>
</div>
<div className="flex flex-col mt-1">
<span className="text-[9px] uppercase text-cyan-600 font-bold tracking-wider print:text-cyan-800">Workshop</span>
<span className="text-xs font-black text-slate-800">2026 / 03</span>
</div>
</div>
</div>
</div>
{/* Bottom Call to Action & Gemini Feature 2 Trigger - COMPACT */}
<div className="space-y-2 transform translate-y-1">
<div className="bg-gradient-to-r from-sky-400 via-blue-500 to-cyan-500 rounded-xl p-3 text-white shadow-lg shadow-sky-200 border border-white/20 print:bg-none print:bg-slate-100 print:text-slate-800 print:shadow-none print:border-slate-200">
<p className="text-xs text-center font-bold tracking-wide">
早期想法、原型、踩坑经验,甚至负面结果,统统欢迎!
</p>
</div>
{/* Chat Button (Hidden on Print) */}
<button
onClick={() => setShowChatModal(true)}
className="w-full bg-white/80 backdrop-blur-md hover:bg-white text-blue-600 p-2.5 rounded-xl font-black shadow-md border border-blue-100 flex items-center justify-center transition-all group print:hidden text-xs"
>
<MessageSquare className="w-4 h-4 mr-2 group-hover:scale-110 transition-transform" />
<Sparkles className="w-3 h-3 mr-1 text-yellow-400 animate-pulse" />
与未来的 Agentic OS 对话
</button>
</div>
</div>
{/* Footer & QR Code Section - COMPACT */}
<div className="bg-white p-4 pb-6 pt-3 text-center mt-2 border-t border-slate-100">
<div className="flex flex-row items-center justify-center space-x-4">
<div className="bg-white p-1.5 rounded-lg shadow-md border border-slate-100 print:shadow-none print:border-slate-200">
{/* QR Code with Blue Color (0284c7) to match theme */}
<img
src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://os-for-agent.github.io/&color=0284c7"
alt="QR Code"
className="w-16 h-16 object-contain rounded-md"
/>
</div>
<div className="text-left">
<p className="text-slate-400 text-[9px] uppercase tracking-widest font-semibold mb-0.5">Visit Website</p>
<p className="text-transparent bg-clip-text bg-gradient-to-r from-sky-600 to-blue-600 font-black text-sm print:text-sky-700">os-for-agent.github.io</p>
<p className="text-slate-600 text-[10px] mt-1 font-bold">
来现场!一起画出未来系统的模样
</p>
</div>
</div>
</div>
</div>
</div>
{/* Gemini Feature 2: Chat Modal Interface (Hidden on Print) */}
{showChatModal && (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 h-full bg-black/20 backdrop-blur-sm print:hidden">
<div className="bg-white w-full max-w-md h-[80vh] rounded-[2rem] shadow-2xl border border-sky-100 flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-300">
{/* Modal Header */}
<div className="bg-gradient-to-r from-sky-500 to-blue-600 p-4 text-white flex justify-between items-center shrink-0">
<div className="flex items-center">
<Bot className="w-6 h-6 mr-2 text-sky-100" />
<h3 className="font-bold text-lg">Agentic OS 原型机</h3>
</div>
<button onClick={() => setShowChatModal(false)} className="text-white/80 hover:text-white transition-colors">
<X className="w-6 h-6" />
</button>
</div>
{/* Chat History */}
<div className="flex-grow overflow-y-auto p-4 space-y-4 bg-slate-50">
{chatHistory.map((msg, index) => (
<div key={index} className={`flex ${msg.role === 'user' ? 'justify-end' : 'justify-start'}`}>
<div className={`max-w-[85%] rounded-2xl p-3 text-sm font-medium leading-relaxed ${
msg.role === 'user'
? 'bg-blue-500 text-white rounded-tr-none'
: 'bg-white border border-slate-200 text-slate-700 rounded-tl-none shadow-sm'
}`}>
{msg.text}
</div>
</div>
))}
{isChatLoading && (
<div className="flex justify-start">
<div className="bg-white border border-slate-200 p-3 rounded-2xl rounded-tl-none shadow-sm flex items-center space-x-2">
<Sparkles className="w-4 h-4 text-sky-500 animate-spin" />
<span className="text-xs text-slate-400">Thinking...</span>
</div>
</div>
)}
<div ref={chatEndRef} />
</div>
{/* Input Area */}
<div className="p-4 bg-white border-t border-slate-100 shrink-0">
<div className="flex items-center space-x-2">
<input
type="text"
value={userMessage}
onChange={(e) => setUserMessage(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && handleSendMessage()}
placeholder="Ask about the OS or Workshop..."
className="flex-grow bg-slate-100 text-slate-800 rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-sky-500 transition-all placeholder:text-slate-400 text-sm"
autoFocus
/>
<button
onClick={handleSendMessage}
disabled={isChatLoading || !userMessage.trim()}
className="p-3 bg-sky-500 hover:bg-sky-600 text-white rounded-xl transition-colors disabled:opacity-50 disabled:cursor-not-allowed shadow-md shadow-sky-200"
>
<Send className="w-5 h-5" />
</button>
</div>
</div>
</div>
</div>
)}
</div>
);
};
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
</script>
</body>
</html>