-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
339 lines (323 loc) · 12.1 KB
/
Copy pathindex.html
File metadata and controls
339 lines (323 loc) · 12.1 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
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Prism</title>
<link rel="stylesheet" href="/src/styles/main.css" />
</head>
<body class="dark">
<div id="app">
<!-- Toolbar -->
<header id="toolbar">
<div class="toolbar-left">
<button id="btn-open" title="打开文件 (Cmd+O)">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
<path
d="M2 3h5l1.5 1.5H14v9.5H2V3z"
stroke="currentColor"
stroke-width="1.2"
fill="none"
/>
</svg>
<span>打开</span>
</button>
<div id="file-name-wrap" class="file-name-wrap hidden">
<span id="file-name" class="file-name">未打开文件</span>
<button id="btn-recent" class="btn-recent" title="最近文件">
<svg width="8" height="5" viewBox="0 0 8 5" fill="none">
<path
d="M1 1l3 3 3-3"
stroke="currentColor"
stroke-width="1.3"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</button>
<div id="recent-dropdown" class="recent-dropdown hidden"></div>
</div>
</div>
<div class="toolbar-center">
<div class="search-box">
<svg width="14" height="14" viewBox="0 0 16 16" fill="none">
<circle cx="7" cy="7" r="5" stroke="currentColor" stroke-width="1.3" />
<path
d="M11 11l3.5 3.5"
stroke="currentColor"
stroke-width="1.3"
stroke-linecap="round"
/>
</svg>
<input type="text" id="search-input" placeholder="搜索 (Cmd+F)" />
</div>
</div>
<div class="toolbar-right">
<button id="btn-playground" title="Playground — 粘贴测试 JSON/Markdown">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
<rect
x="2"
y="3"
width="12"
height="10"
rx="1.5"
stroke="currentColor"
stroke-width="1.2"
fill="none"
/>
<path
d="M5 6l2 2-2 2M9 10h2"
stroke="currentColor"
stroke-width="1.2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
<span>Playground</span>
</button>
<button id="btn-settings" title="设置 — JSONL 字段映射关系">
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.8"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="3" />
<path
d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"
/>
</svg>
</button>
<button id="btn-theme" title="切换主题 (T)">
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.8"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="5" />
<line x1="12" y1="1" x2="12" y2="3" />
<line x1="12" y1="21" x2="12" y2="23" />
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
<line x1="1" y1="12" x2="3" y2="12" />
<line x1="21" y1="12" x2="23" y2="12" />
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
</svg>
</button>
</div>
</header>
<!-- Main content -->
<main id="main-content">
<!-- Sidebar: entry list -->
<aside id="sidebar">
<div class="sidebar-header">
<span id="entry-count">0 条记录</span>
</div>
<div id="entry-list" class="entry-list"></div>
</aside>
<!-- Resizer -->
<div class="resizer" id="resizer-left"></div>
<!-- Center panel -->
<section id="center-panel">
<div class="panel-tabs">
<div class="panel-tabs-left">
<button class="tab-btn active" data-tab="json">JSON</button>
<button class="tab-btn" data-tab="chat">对话</button>
<button class="tab-btn" data-tab="raw">原始</button>
</div>
<div class="panel-tabs-right">
<button id="btn-copy-entry" class="tab-nav-btn" title="复制当前条目 JSON">
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
</svg>
</button>
<button id="btn-prev" class="tab-nav-btn" title="上一条 (↑)" disabled>
<svg width="14" height="14" viewBox="0 0 16 16" fill="none">
<path
d="M10 12L6 8l4-4"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</button>
<span id="entry-nav-pos" class="entry-nav-pos">- / -</span>
<button id="btn-next" class="tab-nav-btn" title="下一条 (↓)" disabled>
<svg width="14" height="14" viewBox="0 0 16 16" fill="none">
<path
d="M6 4l4 4-4 4"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</button>
</div>
</div>
<div id="tab-content" class="tab-content">
<div id="view-json" class="view active"></div>
<div id="view-chat" class="view"></div>
<div id="view-raw" class="view"></div>
</div>
</section>
<!-- Resizer -->
<div class="resizer" id="resizer-right"></div>
<!-- Right panel: Markdown preview -->
<section id="preview-panel">
<div class="panel-tabs">
<button class="tab-btn active" data-tab="rendered">渲染</button>
<button class="tab-btn" data-tab="source">源码</button>
</div>
<div class="tab-content">
<div id="view-rendered" class="view active"></div>
<div id="view-source" class="view"></div>
</div>
</section>
</main>
<!-- Playground -->
<div id="playground-panel" class="hidden"></div>
<!-- Status bar -->
<footer id="statusbar">
<span id="status-entry">就绪</span>
<span id="status-size"></span>
<span id="status-messages"></span>
<span id="status-chars"></span>
<span id="status-errors"></span>
</footer>
<!-- Welcome screen overlay -->
<div id="welcome-screen">
<div class="welcome-content">
<div class="welcome-icon">
<svg width="64" height="64" viewBox="0 0 64 64" fill="none">
<rect
x="8"
y="8"
width="48"
height="48"
rx="8"
stroke="currentColor"
stroke-width="2"
/>
<path
d="M20 24h24M20 32h18M20 40h12"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
</div>
<h1>Prism</h1>
<p>打开 .jsonl 文件以查看格式化 JSON 和 Markdown 预览</p>
<button id="btn-welcome-open">
<svg width="20" height="20" viewBox="0 0 16 16" fill="none">
<path
d="M2 3h5l1.5 1.5H14v9.5H2V3z"
stroke="currentColor"
stroke-width="1.2"
fill="none"
/>
</svg>
选择文件
</button>
<p class="hint">或将 .jsonl 文件拖拽到此窗口</p>
</div>
<div id="recent-files" class="recent-files hidden">
<div class="recent-files-title">最近打开</div>
<div id="recent-files-list"></div>
</div>
</div>
</div>
<!-- Settings modal -->
<div id="settings-modal" class="modal hidden">
<div class="modal-content">
<h3>字段映射设置</h3>
<p class="modal-desc">
不同 JSONL 格式使用的字段名不同,此处定义映射关系,修改后下次打开文件生效。
</p>
<div class="form-group">
<label>数据格式</label>
<div class="radio-group">
<label class="radio-label">
<input type="radio" name="format" value="chat" checked />
<span>对话格式</span>
<em class="radio-hint">{messages: [{role, content}]}</em>
</label>
<label class="radio-label">
<input type="radio" name="format" value="prompt" />
<span>提示词格式</span>
<em class="radio-hint">{prompt, result}</em>
</label>
</div>
</div>
<div class="form-group">
<label for="set-task-id">task_id 字段名</label>
<input
type="text"
id="set-task-id"
value="task_id"
placeholder="task_id"
spellcheck="false"
/>
</div>
<div class="form-group field-chat">
<label for="set-messages">messages 字段名</label>
<input
type="text"
id="set-messages"
value="messages"
placeholder="messages"
spellcheck="false"
/>
</div>
<div class="form-group field-prompt hidden">
<label for="set-prompt">prompt 字段名</label>
<input
type="text"
id="set-prompt"
value="prompt"
placeholder="prompt"
spellcheck="false"
/>
</div>
<div class="form-group field-prompt hidden">
<label for="set-result">result 字段名</label>
<input
type="text"
id="set-result"
value="result"
placeholder="result"
spellcheck="false"
/>
</div>
<div class="modal-actions">
<button id="btn-reset-settings" class="btn-text">恢复默认</button>
<button id="btn-cancel-settings" class="btn-secondary">取消</button>
<button id="btn-save-settings" class="btn-primary">保存</button>
</div>
</div>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>