qdqd commited on
Commit
226c02b
·
verified ·
1 Parent(s): bba1215

Upload 2 files

Browse files
Files changed (2) hide show
  1. static/style.css +691 -0
  2. templates/index.html +294 -0
static/style.css ADDED
@@ -0,0 +1,691 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --wattpad-orange: #FF8F00;
3
+ --wattpad-orange-light: #FFB74D;
4
+ --wattpad-orange-dark: #F57C00;
5
+ --wattpad-white: #FFFFFF;
6
+ --text-color: #333333;
7
+ --text-secondary: #666666;
8
+ --background-light: #f8f9fa;
9
+ --shadow-color: rgba(0, 0, 0, 0.1);
10
+ --border-color: #e0e0e0;
11
+ }
12
+
13
+ * {
14
+ margin: 0;
15
+ padding: 0;
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ body {
20
+ font-family: 'Source Sans Pro', sans-serif;
21
+ line-height: 1.6;
22
+ color: var(--text-color);
23
+ background-color: var(--background-light);
24
+ }
25
+
26
+ /* Navbar Styles */
27
+ .navbar {
28
+ background-color: var(--wattpad-white);
29
+ box-shadow: 0 2px 4px var(--shadow-color);
30
+ position: sticky;
31
+ top: 0;
32
+ z-index: 1000;
33
+ }
34
+
35
+ .nav-container {
36
+ max-width: 1200px;
37
+ margin: 0 auto;
38
+ padding: 0.8rem 20px;
39
+ display: flex;
40
+ justify-content: space-between;
41
+ align-items: center;
42
+ }
43
+
44
+ .logo {
45
+ display: flex;
46
+ align-items: center;
47
+ gap: 0.5rem;
48
+ }
49
+
50
+ .logo i {
51
+ color: var(--wattpad-orange);
52
+ font-size: 1.8rem;
53
+ }
54
+
55
+ .logo h1 {
56
+ color: var(--wattpad-orange);
57
+ font-size: 1.8rem;
58
+ font-weight: 700;
59
+ }
60
+
61
+ .logo span {
62
+ color: var(--text-color);
63
+ }
64
+
65
+ .nav-links {
66
+ display: flex;
67
+ gap: 1.5rem;
68
+ }
69
+
70
+ .nav-links a {
71
+ color: var(--text-secondary);
72
+ text-decoration: none;
73
+ font-weight: 600;
74
+ display: flex;
75
+ align-items: center;
76
+ gap: 0.5rem;
77
+ transition: color 0.3s ease;
78
+ }
79
+
80
+ .nav-links a:hover,
81
+ .nav-links a.active {
82
+ color: var(--wattpad-orange);
83
+ }
84
+
85
+ .nav-links i {
86
+ font-size: 1.1rem;
87
+ }
88
+
89
+ /* Container Styles */
90
+ .container {
91
+ max-width: 1200px;
92
+ margin: 0 auto;
93
+ padding: 2rem 20px;
94
+ }
95
+
96
+ /* Story Generator Styles */
97
+ .story-generator {
98
+ background-color: var(--wattpad-white);
99
+ border-radius: 15px;
100
+ padding: 2rem;
101
+ box-shadow: 0 4px 6px var(--shadow-color);
102
+ }
103
+
104
+ .input-section {
105
+ text-align: center;
106
+ margin-bottom: 2rem;
107
+ }
108
+
109
+ .input-container {
110
+ max-width: 600px;
111
+ margin: 0 auto;
112
+ padding: 0 1rem;
113
+ }
114
+
115
+ .input-group {
116
+ display: flex;
117
+ gap: 0.5rem;
118
+ margin-bottom: 0.75rem;
119
+ }
120
+
121
+ .input-wrapper {
122
+ flex: 1;
123
+ position: relative;
124
+ }
125
+
126
+ .input-icon {
127
+ position: absolute;
128
+ left: 1rem;
129
+ top: 50%;
130
+ transform: translateY(-50%);
131
+ color: var(--text-secondary);
132
+ }
133
+
134
+ #topic {
135
+ width: 100%;
136
+ padding: 0.8rem 1rem 0.8rem 2.5rem;
137
+ border: 1px solid var(--border-color);
138
+ border-radius: 8px;
139
+ font-size: 0.95rem;
140
+ color: var(--text-color);
141
+ background-color: var(--wattpad-white);
142
+ }
143
+
144
+ #topic:focus {
145
+ outline: none;
146
+ border-color: var(--wattpad-orange);
147
+ }
148
+
149
+ #generate-btn {
150
+ background-color: var(--wattpad-orange);
151
+ color: white;
152
+ border: none;
153
+ padding: 0 1.5rem;
154
+ border-radius: 8px;
155
+ font-weight: 600;
156
+ cursor: pointer;
157
+ display: flex;
158
+ align-items: center;
159
+ gap: 0.5rem;
160
+ transition: background-color 0.3s ease;
161
+ }
162
+
163
+ #generate-btn:hover {
164
+ background-color: var(--wattpad-orange-dark);
165
+ }
166
+
167
+ /* Mode Selector Styles */
168
+ .mode-selector {
169
+ display: flex;
170
+ flex-direction: column;
171
+ align-items: flex-start;
172
+ padding-left: 2.5rem;
173
+ }
174
+
175
+ .mode-buttons {
176
+ display: inline-flex;
177
+ gap: 0.5rem;
178
+ }
179
+
180
+ .mode-btn {
181
+ display: inline-flex;
182
+ align-items: center;
183
+ gap: 0.4rem;
184
+ padding: 0.4rem 0.8rem;
185
+ border: 1px solid var(--border-color);
186
+ border-radius: 6px;
187
+ background: var(--wattpad-white);
188
+ color: var(--text-secondary);
189
+ font-size: 0.9rem;
190
+ font-weight: 500;
191
+ cursor: pointer;
192
+ transition: all 0.2s ease;
193
+ }
194
+
195
+ .mode-btn i {
196
+ font-size: 0.9rem;
197
+ opacity: 0.7;
198
+ }
199
+
200
+ .mode-btn:hover {
201
+ border-color: var(--wattpad-orange-light);
202
+ color: var(--wattpad-orange);
203
+ }
204
+
205
+ .mode-btn.active {
206
+ background: var(--wattpad-orange);
207
+ border-color: var(--wattpad-orange);
208
+ color: white;
209
+ }
210
+
211
+ .mode-btn.active i {
212
+ opacity: 1;
213
+ }
214
+
215
+ .mode-note {
216
+ display: none;
217
+ }
218
+
219
+ /* Loading Spinner Styles */
220
+ .loading-spinner {
221
+ display: flex;
222
+ flex-direction: column;
223
+ align-items: center;
224
+ justify-content: center;
225
+ padding: 3rem;
226
+ }
227
+
228
+ .spinner {
229
+ width: 50px;
230
+ height: 50px;
231
+ border: 3px solid var(--background-light);
232
+ border-top: 3px solid var(--wattpad-orange);
233
+ border-radius: 50%;
234
+ animation: spin 1s linear infinite;
235
+ margin-bottom: 1rem;
236
+ }
237
+
238
+ .loading-spinner p {
239
+ color: var(--text-secondary);
240
+ font-size: 1.1rem;
241
+ display: flex;
242
+ align-items: center;
243
+ gap: 0.5rem;
244
+ }
245
+
246
+ /* Story Container Styles */
247
+ .story-container {
248
+ max-width: 800px;
249
+ margin: 2rem auto;
250
+ background-color: var(--wattpad-white);
251
+ border-radius: 15px;
252
+ padding: 2rem;
253
+ box-shadow: 0 4px 6px var(--shadow-color);
254
+ }
255
+
256
+ .story-header {
257
+ margin-bottom: 2rem;
258
+ }
259
+
260
+ .story-meta {
261
+ display: flex;
262
+ align-items: center;
263
+ gap: 1rem;
264
+ margin-bottom: 1rem;
265
+ }
266
+
267
+ .story-icon {
268
+ font-size: 2rem;
269
+ color: var(--wattpad-orange);
270
+ }
271
+
272
+ .story-title {
273
+ color: var(--text-color);
274
+ font-size: 2rem;
275
+ font-weight: 700;
276
+ }
277
+
278
+ .story-stats {
279
+ display: flex;
280
+ gap: 1.5rem;
281
+ color: var(--text-secondary);
282
+ font-size: 0.9rem;
283
+ }
284
+
285
+ .story-stats span {
286
+ display: flex;
287
+ align-items: center;
288
+ gap: 0.5rem;
289
+ }
290
+
291
+ .chapter-header {
292
+ margin-bottom: 1.5rem;
293
+ padding-bottom: 1rem;
294
+ border-bottom: 1px solid var(--border-color);
295
+ }
296
+
297
+ .chapter-header h4 {
298
+ font-size: 1.5rem;
299
+ color: var(--text-color);
300
+ font-weight: 600;
301
+ }
302
+
303
+ .story-content {
304
+ font-size: 1.1rem;
305
+ line-height: 1.8;
306
+ color: var(--text-color);
307
+ }
308
+
309
+ .content-warning {
310
+ background-color: #fff3cd;
311
+ color: #856404;
312
+ padding: 1rem;
313
+ border-radius: 10px;
314
+ margin-bottom: 1.5rem;
315
+ display: flex;
316
+ align-items: center;
317
+ gap: 0.5rem;
318
+ }
319
+
320
+ .author-note {
321
+ background-color: var(--background-light);
322
+ padding: 1.5rem;
323
+ border-radius: 10px;
324
+ margin-top: 2rem;
325
+ font-style: italic;
326
+ color: var(--text-secondary);
327
+ display: flex;
328
+ align-items: center;
329
+ gap: 0.5rem;
330
+ }
331
+
332
+ .story-actions {
333
+ display: flex;
334
+ gap: 1rem;
335
+ margin-top: 2rem;
336
+ padding-top: 1.5rem;
337
+ border-top: 1px solid var(--border-color);
338
+ }
339
+
340
+ .action-btn {
341
+ background-color: transparent;
342
+ color: var(--text-secondary);
343
+ border: 1px solid var(--border-color);
344
+ padding: 0.8rem 1.5rem;
345
+ flex: 1;
346
+ }
347
+
348
+ .action-btn:hover {
349
+ background-color: var(--background-light);
350
+ color: var(--wattpad-orange);
351
+ border-color: var(--wattpad-orange);
352
+ transform: translateY(0);
353
+ box-shadow: none;
354
+ }
355
+
356
+ @keyframes spin {
357
+ 0% { transform: rotate(0deg); }
358
+ 100% { transform: rotate(360deg); }
359
+ }
360
+
361
+ /* Mobile Responsiveness */
362
+ @media (max-width: 768px) {
363
+ .nav-container {
364
+ padding: 0.8rem 15px;
365
+ }
366
+
367
+ .logo h1 {
368
+ font-size: 1.5rem;
369
+ }
370
+
371
+ .nav-links {
372
+ gap: 1rem;
373
+ }
374
+
375
+ .nav-links span {
376
+ display: none;
377
+ }
378
+
379
+ .container {
380
+ padding: 1rem 15px;
381
+ }
382
+
383
+ .input-group {
384
+ flex-direction: column;
385
+ }
386
+
387
+ .input-section h2 {
388
+ font-size: 1.5rem;
389
+ }
390
+
391
+ .story-container {
392
+ padding: 1.5rem;
393
+ }
394
+
395
+ .story-title {
396
+ font-size: 1.5rem;
397
+ }
398
+
399
+ .story-stats {
400
+ flex-wrap: wrap;
401
+ gap: 1rem;
402
+ }
403
+
404
+ .story-content {
405
+ font-size: 1rem;
406
+ }
407
+
408
+ .story-actions {
409
+ flex-direction: column;
410
+ }
411
+
412
+ .action-btn {
413
+ width: 100%;
414
+ }
415
+ }
416
+
417
+ /* Chapter Navigation */
418
+ .chapter-navigation {
419
+ display: flex;
420
+ align-items: center;
421
+ justify-content: space-between;
422
+ margin-bottom: 2rem;
423
+ padding: 1rem;
424
+ background-color: var(--background-light);
425
+ border-radius: 10px;
426
+ }
427
+
428
+ .nav-btn {
429
+ background-color: var(--wattpad-white);
430
+ color: var(--text-color);
431
+ border: 1px solid var(--border-color);
432
+ padding: 0.8rem 1.5rem;
433
+ border-radius: 25px;
434
+ cursor: pointer;
435
+ font-size: 0.9rem;
436
+ font-weight: 600;
437
+ display: flex;
438
+ align-items: center;
439
+ gap: 0.5rem;
440
+ transition: all 0.3s ease;
441
+ position: relative;
442
+ }
443
+
444
+ .nav-btn:hover:not(:disabled) {
445
+ background-color: var(--wattpad-orange);
446
+ color: var(--wattpad-white);
447
+ border-color: var(--wattpad-orange);
448
+ }
449
+
450
+ .nav-btn:disabled {
451
+ opacity: 0.5;
452
+ cursor: not-allowed;
453
+ }
454
+
455
+ .chapter-indicator {
456
+ font-size: 1.1rem;
457
+ font-weight: 600;
458
+ color: var(--text-color);
459
+ }
460
+
461
+ /* Chapter Content */
462
+ .chapters-list {
463
+ margin: 2rem 0;
464
+ }
465
+
466
+ .chapter-content {
467
+ display: none;
468
+ }
469
+
470
+ .chapter-content.active {
471
+ display: block;
472
+ animation: fadeIn 0.5s ease;
473
+ }
474
+
475
+ .chapter-title {
476
+ font-size: 1.8rem;
477
+ color: var(--text-color);
478
+ margin-bottom: 1.5rem;
479
+ font-weight: 700;
480
+ }
481
+
482
+ .chapter-summary {
483
+ background-color: var(--background-light);
484
+ padding: 1.5rem;
485
+ border-radius: 10px;
486
+ margin-bottom: 2rem;
487
+ font-style: italic;
488
+ color: var(--text-secondary);
489
+ }
490
+
491
+ .narrative-hook {
492
+ background-color: #e3f2fd;
493
+ padding: 1.5rem;
494
+ border-radius: 10px;
495
+ margin: 2rem 0;
496
+ color: #1976d2;
497
+ font-weight: 500;
498
+ }
499
+
500
+ .chapter-section {
501
+ font-size: 1.1rem;
502
+ line-height: 1.8;
503
+ margin-bottom: 2rem;
504
+ }
505
+
506
+ /* Animations */
507
+ @keyframes fadeIn {
508
+ from {
509
+ opacity: 0;
510
+ transform: translateY(10px);
511
+ }
512
+ to {
513
+ opacity: 1;
514
+ transform: translateY(0);
515
+ }
516
+ }
517
+
518
+ /* Mobile Responsiveness Updates */
519
+ @media (max-width: 768px) {
520
+ .chapter-navigation {
521
+ flex-direction: column;
522
+ gap: 1rem;
523
+ padding: 1rem;
524
+ }
525
+
526
+ .chapter-indicator {
527
+ order: -1;
528
+ margin-bottom: 0.5rem;
529
+ }
530
+
531
+ .nav-btn {
532
+ width: 100%;
533
+ justify-content: center;
534
+ }
535
+
536
+ .chapter-title {
537
+ font-size: 1.5rem;
538
+ }
539
+
540
+ .chapter-summary,
541
+ .narrative-hook {
542
+ padding: 1rem;
543
+ }
544
+ }
545
+
546
+ /* Mobile Responsive Adjustments */
547
+ @media (max-width: 480px) {
548
+ .input-container {
549
+ padding: 0 0.5rem;
550
+ }
551
+
552
+ .input-group {
553
+ flex-direction: column;
554
+ }
555
+
556
+ #generate-btn {
557
+ padding: 0.8rem;
558
+ justify-content: center;
559
+ }
560
+
561
+ .mode-selector {
562
+ padding-left: 0;
563
+ align-items: center;
564
+ }
565
+
566
+ .mode-buttons {
567
+ width: 100%;
568
+ justify-content: center;
569
+ }
570
+
571
+ .mode-btn {
572
+ flex: 1;
573
+ justify-content: center;
574
+ padding: 0.35rem 0.6rem;
575
+ font-size: 0.85rem;
576
+ }
577
+ }
578
+
579
+ /* Contemplation Section Styles */
580
+ .contemplation-section {
581
+ background: var(--wattpad-white);
582
+ border: 1px solid var(--border-color);
583
+ border-radius: 8px;
584
+ margin: 1rem 0;
585
+ overflow: hidden;
586
+ }
587
+
588
+ .contemplation-header {
589
+ display: flex;
590
+ justify-content: space-between;
591
+ align-items: center;
592
+ padding: 0.75rem 1rem;
593
+ background: var(--background-light);
594
+ cursor: pointer;
595
+ transition: background-color 0.2s ease;
596
+ }
597
+
598
+ .contemplation-header:hover {
599
+ background: var(--background-lighter);
600
+ }
601
+
602
+ .thinking-indicator {
603
+ display: flex;
604
+ align-items: center;
605
+ gap: 0.5rem;
606
+ color: var(--text-secondary);
607
+ font-size: 0.9rem;
608
+ font-weight: 500;
609
+ }
610
+
611
+ .thinking-indicator i {
612
+ color: var(--wattpad-orange);
613
+ font-size: 0.85rem;
614
+ }
615
+
616
+ .toggle-contemplation {
617
+ background: none;
618
+ border: none;
619
+ padding: 0;
620
+ color: var(--text-secondary);
621
+ cursor: pointer;
622
+ display: flex;
623
+ align-items: center;
624
+ justify-content: center;
625
+ width: 24px;
626
+ height: 24px;
627
+ border-radius: 4px;
628
+ transition: all 0.2s ease;
629
+ }
630
+
631
+ .toggle-contemplation:hover {
632
+ background: rgba(0, 0, 0, 0.05);
633
+ color: var(--text-color);
634
+ }
635
+
636
+ .toggle-contemplation i {
637
+ transition: transform 0.2s ease;
638
+ }
639
+
640
+ .contemplation-section.collapsed .toggle-contemplation i {
641
+ transform: rotate(180deg);
642
+ }
643
+
644
+ .contemplation-content {
645
+ padding: 1rem;
646
+ color: var(--text-secondary);
647
+ font-size: 0.9rem;
648
+ line-height: 1.6;
649
+ max-height: 300px;
650
+ overflow-y: auto;
651
+ transition: max-height 0.3s ease-out;
652
+ }
653
+
654
+ .contemplation-section.collapsed .contemplation-content {
655
+ max-height: 0;
656
+ padding: 0 1rem;
657
+ overflow: hidden;
658
+ }
659
+
660
+ .contemplation-content p {
661
+ margin-bottom: 0.75rem;
662
+ }
663
+
664
+ .contemplation-content p:last-child {
665
+ margin-bottom: 0;
666
+ }
667
+
668
+ @media (max-width: 480px) {
669
+ .contemplation-section {
670
+ margin: 0.75rem 0;
671
+ border-radius: 6px;
672
+ }
673
+
674
+ .contemplation-header {
675
+ padding: 0.6rem 0.75rem;
676
+ }
677
+
678
+ .thinking-indicator {
679
+ font-size: 0.85rem;
680
+ }
681
+ }
682
+
683
+ /* Remove old styles */
684
+ .mode-label,
685
+ .mode-note,
686
+ .mode-toggle,
687
+ .toggle-label,
688
+ .mode-text,
689
+ .mode-select {
690
+ display: none;
691
+ }
templates/index.html ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Wattpad Story Generator</title>
7
+ <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
8
+ <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
10
+ </head>
11
+ <body>
12
+ <nav class="navbar">
13
+ <div class="nav-container">
14
+ <div class="logo">
15
+ <i class="fas fa-book-open"></i>
16
+ <h1>Story<span>AI</span></h1>
17
+ </div>
18
+ <div class="nav-links">
19
+ <a href="#" class="active"><i class="fas fa-magic"></i> Generate</a>
20
+ <a href="#"><i class="fas fa-book"></i> Library</a>
21
+ </div>
22
+ </div>
23
+ </nav>
24
+
25
+ <div class="container">
26
+ <main>
27
+ <div class="story-generator">
28
+ <div class="input-section">
29
+ <h2><i class="fas fa-feather-alt"></i> Create Your Story</h2>
30
+ <p class="subtitle">Transform your ideas into captivating stories</p>
31
+
32
+ <div class="input-container">
33
+ <div class="input-group">
34
+ <div class="input-wrapper">
35
+ <i class="fas fa-pencil-alt input-icon"></i>
36
+ <input type="text" id="topic" placeholder="Enter your story topic..." required>
37
+ </div>
38
+ <button id="generate-btn">
39
+ <i class="fas fa-wand-magic-sparkles"></i>
40
+ Generate Story
41
+ </button>
42
+ </div>
43
+ <div class="mode-selector">
44
+ <div class="mode-buttons">
45
+ <button class="mode-btn active" data-mode="simple">
46
+ <i class="fas fa-bolt"></i>
47
+ Simple
48
+ </button>
49
+ <button class="mode-btn" data-mode="advanced">
50
+ <i class="fas fa-brain"></i>
51
+ Advanced
52
+ </button>
53
+ </div>
54
+ <div class="mode-note">Advanced mode takes longer to generate</div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <div class="loading-spinner" style="display: none;">
60
+ <div class="spinner"></div>
61
+ <p><i class="fas fa-pen-fancy"></i> Crafting your story with creativity...</p>
62
+ </div>
63
+
64
+ <div class="story-container" style="display: none;">
65
+ <div class="contemplation-wrapper">
66
+ <div class="contemplation-section">
67
+ <div class="contemplation-header">
68
+ <div class="thinking-indicator">
69
+ <i class="fas fa-circle-notch fa-spin"></i>
70
+ Thinking...
71
+ </div>
72
+ <button class="toggle-contemplation" aria-label="Toggle thinking process">
73
+ <i class="fas fa-chevron-up"></i>
74
+ </button>
75
+ </div>
76
+ <div class="contemplation-content"></div>
77
+ </div>
78
+ </div>
79
+
80
+ <div class="chapter-navigation">
81
+ <button class="nav-btn" id="prev-chapter" disabled>
82
+ <i class="fas fa-chevron-left"></i> Previous Chapter
83
+ </button>
84
+ <span class="chapter-indicator">Chapter <span id="current-chapter">1</span></span>
85
+ <button class="nav-btn" id="next-chapter">
86
+ Next Chapter <i class="fas fa-chevron-right"></i>
87
+ </button>
88
+ </div>
89
+
90
+ <div class="story-header">
91
+ <div class="story-meta">
92
+ <i class="fas fa-book-open story-icon"></i>
93
+ <h3 class="story-title"></h3>
94
+ </div>
95
+ <div class="story-stats">
96
+ <span><i class="fas fa-eye"></i> 0 Reads</span>
97
+ <span><i class="fas fa-star"></i> 0 Votes</span>
98
+ <span><i class="fas fa-comment"></i> 0 Comments</span>
99
+ </div>
100
+ </div>
101
+
102
+ <div class="chapters-list">
103
+ <!-- Chapters will be dynamically added here -->
104
+ </div>
105
+
106
+ <div class="story-actions">
107
+ <button class="action-btn"><i class="fas fa-star"></i> Vote</button>
108
+ <button class="action-btn"><i class="fas fa-comment"></i> Comment</button>
109
+ <button class="action-btn"><i class="fas fa-share"></i> Share</button>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </main>
114
+ </div>
115
+
116
+ <script>
117
+ document.addEventListener('DOMContentLoaded', function() {
118
+ // Initialize thinking section toggle
119
+ const contemplationSection = document.querySelector('.contemplation-section');
120
+ const contemplationHeader = document.querySelector('.contemplation-header');
121
+
122
+ if (contemplationHeader) {
123
+ contemplationHeader.addEventListener('click', function() {
124
+ contemplationSection.classList.toggle('collapsed');
125
+ });
126
+ }
127
+
128
+ let currentChapter = 1;
129
+ let allChapters = [];
130
+ let currentTopic = '';
131
+ let isAdvancedMode = false;
132
+
133
+ // Mode selection handling
134
+ const modeButtons = document.querySelectorAll('.mode-btn');
135
+ modeButtons.forEach(button => {
136
+ button.addEventListener('click', function() {
137
+ modeButtons.forEach(btn => btn.classList.remove('active'));
138
+ this.classList.add('active');
139
+ isAdvancedMode = this.dataset.mode === 'advanced';
140
+ });
141
+ });
142
+
143
+ document.getElementById('generate-btn').addEventListener('click', async () => {
144
+ const topic = document.getElementById('topic').value.trim();
145
+ if (!topic) {
146
+ alert('Please enter a topic');
147
+ return;
148
+ }
149
+
150
+ currentTopic = topic;
151
+ currentChapter = 1;
152
+ allChapters = [];
153
+ await generateChapter(topic);
154
+ });
155
+
156
+ document.getElementById('next-chapter').addEventListener('click', async () => {
157
+ // Only use the last chapter as context
158
+ const lastChapter = allChapters[allChapters.length - 1].content;
159
+ currentChapter++;
160
+ await generateChapter(currentTopic, lastChapter);
161
+ });
162
+
163
+ document.getElementById('prev-chapter').addEventListener('click', () => {
164
+ if (currentChapter > 1) {
165
+ currentChapter--;
166
+ updateChapterDisplay();
167
+ updateNavigationButtons();
168
+ }
169
+ });
170
+
171
+ async function generateChapter(topic, previousChapter = '') {
172
+ const loadingSpinner = document.querySelector('.loading-spinner');
173
+ const storyContainer = document.querySelector('.story-container');
174
+ const contemplationSection = document.querySelector('.contemplation-section');
175
+
176
+ loadingSpinner.style.display = 'flex';
177
+ storyContainer.style.display = 'none';
178
+ if (contemplationSection) {
179
+ contemplationSection.style.display = 'none';
180
+ }
181
+
182
+ try {
183
+ const response = await fetch('/generate', {
184
+ method: 'POST',
185
+ headers: {
186
+ 'Content-Type': 'application/json'
187
+ },
188
+ body: JSON.stringify({
189
+ topic,
190
+ previous_chapter: previousChapter,
191
+ chapter_number: currentChapter,
192
+ mode: isAdvancedMode ? 'advanced' : 'simple'
193
+ })
194
+ });
195
+
196
+ const data = await response.json();
197
+
198
+ if (data.error) {
199
+ throw new Error(data.error);
200
+ }
201
+
202
+ let storyContent = data.story;
203
+ if (isAdvancedMode) {
204
+ // Extract content between <contemplator> tags for thinking section
205
+ const contemplationMatch = storyContent.match(/<contemplator>([\s\S]*?)<\/contemplator>/);
206
+ if (contemplationMatch) {
207
+ const contemplation = contemplationMatch[1].trim();
208
+ const contemplationContent = document.querySelector('.contemplation-content');
209
+ if (contemplationContent) {
210
+ contemplationContent.innerHTML = contemplation
211
+ .split('\n')
212
+ .map(line => `<p>${line.trim()}</p>`)
213
+ .join('');
214
+ contemplationSection.style.display = 'block';
215
+ }
216
+ }
217
+
218
+ // Extract content between <final_answer> tags for the story
219
+ const finalAnswerMatch = storyContent.match(/<final_answer>([\s\S]*?)<\/final_answer>/);
220
+ if (finalAnswerMatch) {
221
+ storyContent = finalAnswerMatch[1].trim();
222
+ } else {
223
+ // If no final_answer tags found, use the content after removing contemplator section
224
+ storyContent = storyContent.replace(/<contemplator>[\s\S]*?<\/contemplator>/g, '').trim();
225
+ }
226
+ }
227
+
228
+ allChapters[currentChapter - 1] = formatChapter(storyContent, currentChapter);
229
+ updateChapterDisplay();
230
+ updateNavigationButtons();
231
+
232
+ loadingSpinner.style.display = 'none';
233
+ storyContainer.style.display = 'block';
234
+
235
+ document.querySelector('.story-title').textContent = topic;
236
+
237
+ } catch (error) {
238
+ alert('Error generating story: ' + error.message);
239
+ loadingSpinner.style.display = 'none';
240
+ }
241
+ }
242
+
243
+ // Toggle contemplation visibility
244
+ document.querySelector('.toggle-contemplation')?.addEventListener('click', function() {
245
+ const content = document.querySelector('.contemplation-content');
246
+ const icon = this.querySelector('i');
247
+ if (content.style.maxHeight) {
248
+ content.style.maxHeight = null;
249
+ icon.classList.replace('fa-chevron-down', 'fa-chevron-up');
250
+ } else {
251
+ content.style.maxHeight = content.scrollHeight + "px";
252
+ icon.classList.replace('fa-chevron-up', 'fa-chevron-down');
253
+ }
254
+ });
255
+
256
+ function updateChapterDisplay() {
257
+ const chaptersContainer = document.querySelector('.chapters-list');
258
+ chaptersContainer.innerHTML = '';
259
+
260
+ allChapters.forEach((chapter, index) => {
261
+ const chapterDiv = document.createElement('div');
262
+ chapterDiv.className = 'chapter-content' + (index + 1 === currentChapter ? ' active' : '');
263
+ chapterDiv.style.display = index + 1 === currentChapter ? 'block' : 'none';
264
+ chapterDiv.innerHTML = chapter.content;
265
+ chaptersContainer.appendChild(chapterDiv);
266
+ });
267
+
268
+ document.getElementById('current-chapter').textContent = currentChapter;
269
+ }
270
+
271
+ function updateNavigationButtons() {
272
+ const prevButton = document.getElementById('prev-chapter');
273
+ const nextButton = document.getElementById('next-chapter');
274
+
275
+ prevButton.disabled = currentChapter === 1;
276
+ nextButton.disabled = false;
277
+ }
278
+
279
+ function formatChapter(content, chapterNum) {
280
+ return {
281
+ content: content
282
+ .replace(/\n/g, '<br>')
283
+ .replace(/<chapter>/g, `<div class="chapter-section">`)
284
+ .replace(/<\/chapter>/g, '</div>')
285
+ .replace(/<chapter_number>(.*?)<\/chapter_number>/g, `<h4 class="chapter-title">Chapter ${chapterNum}</h4>`)
286
+ .replace(/<chapter_summary>(.*?)<\/chapter_summary>/g, '<div class="chapter-summary">$1</div>')
287
+ .replace(/<narrative_hook>(.*?)<\/narrative_hook>/g, '<div class="narrative-hook">$1</div>')
288
+ .replace(/<content_warning>(.*?)<\/content_warning>/g, '<div class="content-warning"><i class="fas fa-exclamation-triangle"></i> Content Warning: $1</div>')
289
+ };
290
+ }
291
+ });
292
+ </script>
293
+ </body>
294
+ </html>