-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreview.html
More file actions
211 lines (192 loc) · 8.3 KB
/
preview.html
File metadata and controls
211 lines (192 loc) · 8.3 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Chat Exporter — Preview & Select</title>
<style>
:root {
--bg: #f4f5f7; --surface: #fff; --border: #e2e4e8;
--text: #1a1a2e; --text-sec: #6b7280; --accent: #6366f1;
--accent-dim: rgba(99,102,241,0.08); --radius: 10px;
--font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--font-mono: 'SF Mono','Fira Code','Cascadia Code',monospace;
--user-bg: #eef2ff; --assist-bg: #fff;
--check-size: 18px;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { background:var(--bg); color:var(--text); font-family:var(--font); line-height:1.6; }
/* ── Toolbar ── */
#toolbar {
position: sticky; top: 0; z-index: 100;
background: #1e1b4b; color: #fff;
display: flex; align-items: center; gap: 12px;
padding: 10px 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.2);
flex-wrap: wrap;
}
#toolbar h1 { font-size: 15px; font-weight: 600; margin-right: 8px; white-space: nowrap; }
.toolbar-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.2); flex-shrink:0; }
.sel-count { font-size: 13px; color: rgba(255,255,255,0.7); white-space:nowrap; }
.toolbar-btns { display:flex; gap:6px; margin-left:auto; flex-wrap:wrap; }
.tb-btn {
display: flex; align-items: center; gap: 5px;
padding: 6px 14px; border-radius: 6px; font-size: 13px;
font-weight: 500; cursor: pointer; border: none; font-family: inherit;
transition: all 0.15s; white-space: nowrap;
}
.tb-btn.secondary { background: rgba(255,255,255,0.1); color: #fff; }
.tb-btn.secondary:hover { background: rgba(255,255,255,0.2); }
.tb-btn.primary { background: #6366f1; color: #fff; }
.tb-btn.primary:hover { background: #4f46e5; }
.tb-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fmt-select {
background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2);
border-radius: 6px; padding: 5px 10px; font-size: 13px; cursor: pointer;
font-family: inherit;
}
.fmt-select option { background: #1e1b4b; color: #fff; }
/* ── Layout ── */
#main { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
/* ── Chat meta ── */
#chat-meta {
background: var(--surface); border: 1px solid var(--border);
border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px;
font-size: 13px; color: var(--text-sec);
display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
}
#chat-meta strong { color: var(--text); }
.platform-badge {
display: inline-flex; align-items: center; gap: 5px;
background: rgba(99,102,241,0.1); color: var(--accent);
padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
/* ── Message card ── */
.msg-card {
background: var(--surface); border: 2px solid var(--border);
border-radius: var(--radius); margin-bottom: 10px;
transition: border-color 0.15s, opacity 0.15s;
position: relative;
}
.msg-card.user { background: var(--user-bg); }
.msg-card.deselected { opacity: 0.38; border-style: dashed; }
.msg-header {
display: flex; align-items: center; gap: 10px;
padding: 10px 14px 8px; border-bottom: 1px solid var(--border);
cursor: pointer; user-select: none;
}
.msg-header:hover { background: rgba(0,0,0,0.02); }
/* Custom checkbox */
.msg-check {
width: var(--check-size); height: var(--check-size);
border: 2px solid #d1d5db; border-radius: 4px;
background: #fff; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
transition: all 0.15s;
}
.msg-check.checked { background: var(--accent); border-color: var(--accent); }
.msg-check.checked::after {
content: ''; width: 5px; height: 9px;
border: 2px solid #fff; border-top: none; border-left: none;
transform: rotate(45deg) translate(-1px,-1px);
display: block;
}
.role-badge {
font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px;
text-transform: uppercase; letter-spacing: 0.04em;
}
.role-badge.user { background: rgba(79,70,229,0.12); color: #4338ca; }
.role-badge.assistant { background: rgba(217,70,239,0.12); color: #9d174d; }
.msg-timestamp { font-size: 11px; color: var(--text-sec); margin-left: auto; }
.msg-summary { font-size: 12px; color: var(--text-sec); margin-left: 4px; flex: 1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.msg-toggle { font-size: 11px; color: var(--text-sec); margin-left: 8px; flex-shrink:0; }
/* ── Blocks ── */
.msg-blocks { padding: 6px 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.block-row {
display: flex; align-items: flex-start; gap: 8px;
padding: 5px 8px; border-radius: 6px; cursor: pointer;
transition: background 0.1s;
}
.block-row:hover { background: rgba(0,0,0,0.03); }
.block-row.deselected { opacity: 0.35; }
.block-check {
width: 15px; height: 15px; margin-top: 2px;
border: 2px solid #d1d5db; border-radius: 3px;
background: #fff; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
transition: all 0.15s;
}
.block-check.checked { background: var(--accent); border-color: var(--accent); }
.block-check.checked::after {
content: ''; width: 4px; height: 7px;
border: 1.5px solid #fff; border-top: none; border-left: none;
transform: rotate(45deg) translate(-0.5px,-0.5px); display: block;
}
.block-label { font-size: 13px; color: var(--text); line-height: 1.4; }
.block-label code { background: rgba(0,0,0,0.07); padding: 1px 4px; border-radius: 3px; font-family: var(--font-mono); font-size: 0.85em; }
.block-type-tag { font-size: 10px; color: var(--text-sec); background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 10px; margin-left: 4px; }
/* ── Button reset for interactive rows ── */
button.msg-header,
button.block-row {
appearance: none;
border: none;
font: inherit;
color: inherit;
width: 100%;
text-align: left;
}
/* ── Focus indicators ── */
.tb-btn:focus-visible,
.fmt-select:focus-visible {
outline: 2px solid rgba(255,255,255,0.8);
outline-offset: 2px;
}
button.msg-header:focus-visible,
button.block-row:focus-visible {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
/* ── Spinner ── */
#loading { text-align: center; padding: 60px 20px; color: var(--text-sec); font-size: 15px; }
#error-msg { background: #fee2e2; color: #991b1b; padding: 16px 20px; border-radius: 8px; margin: 20px; }
</style>
</head>
<body>
<div id="toolbar">
<h1 data-i18n="previewPageTitle">📋 Preview & Select</h1>
<div class="toolbar-sep"></div>
<span class="sel-count" id="selCount" aria-live="polite" aria-atomic="true"></span>
<div class="toolbar-btns">
<button class="tb-btn secondary" id="btnSelectAll" data-i18n="deselectAll">De-/Select All</button>
<button class="tb-btn secondary" id="btnDeselectPrompts" data-i18n="deselectPrompts">Deselect Prompts</button>
<button class="tb-btn secondary" id="btnDeselectTools" data-i18n="deselectTools">Deselect Tool Output</button>
<div class="toolbar-sep"></div>
<select class="fmt-select" id="fmtSelect" aria-label="Export format">
<option value="html">HTML</option>
<option value="markdown">Markdown</option>
<option value="zip">ZIP</option>
<option value="pdf">PDF</option>
</select>
<button class="tb-btn primary" id="exportBtn" data-i18n="exportSelected">
⬇ Export Selected
</button>
</div>
</div>
<div id="main">
<div id="loading" role="status" aria-live="polite" data-i18n="loadingChat">Loading chat data…</div>
<div id="error-msg" role="alert" style="display:none"></div>
<div id="chat-meta" style="display:none"></div>
<div id="messages"></div>
</div>
<!-- All shared modules bundled inline -->
<script src="shared/utils.js"></script>
<script src="shared/vendor.js"></script>
<script src="shared/widget-css.js"></script>
<script src="shared/html-template.js"></script>
<script src="shared/exporters/markdown.js"></script>
<script src="shared/exporters/html.js"></script>
<script src="shared/exporters/zip.js"></script>
<script src="jszip.min.js"></script>
<script src="shared/i18n.js"></script>
<script src="preview.js"></script>
</body>
</html>