-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patharcr.html
More file actions
654 lines (626 loc) · 30.2 KB
/
arcr.html
File metadata and controls
654 lines (626 loc) · 30.2 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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#000000">
<meta name="description" content="WebXOS ARCR: Create precise AI prompts with the Action, Role, Context, Response system. Build structured prompts for text, visuals, and more.">
<meta name="keywords" content="AI prompt generator, WebXOS ARCR, prompt engineering, AI tools, structured prompts, text generation, visual generation">
<meta name="author" content="WebXOS">
<meta name="robots" content="index, follow">
<!-- Open Graph Meta Tags -->
<meta property="og:title" content="WebXOS ARCR: Advanced Prompt Generator">
<meta property="og:description" content="Craft precise AI prompts using the ARCR system for text, visuals, and more.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://webxos.com/arcr"> <!-- Replace with actual URL -->
<meta property="og:image" content="https://webxos.com/assets/arcr-og-image.jpg"> <!-- Replace with actual image URL -->
<!-- Twitter Card Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="WebXOS ARCR: Advanced Prompt Generator">
<meta name="twitter:description" content="Craft precise AI prompts using the ARCR system for text, visuals, and more.">
<meta name="twitter:image" content="https://webxos.com/assets/arcr-og-image.jpg"> <!-- Replace with actual image URL -->
<title>WebXOS ARCR: Prompt Architect</title>
<link rel="manifest" href="manifest.json">
<link rel="icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
<style>
/* Same CSS as provided */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000;
color: #00ff00;
font-family: 'VT323', monospace;
font-size: 18px;
line-height: 1.4;
display: flex;
flex-direction: column;
height: 100vh;
}
header {
background: #111;
padding: 10px;
text-align: center;
border-bottom: 2px solid #00ff00;
box-shadow: 0 0 10px #00ff00;
}
header h1 {
font-size: 24px;
text-shadow: 0 0 5px #00ff00;
}
#console {
flex: 1;
padding: 15px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #00ff00 #111;
}
#console::-webkit-scrollbar {
width: 6px;
}
#console::-webkit-scrollbar-track {
background: #111;
}
#console::-webkit-scrollbar-thumb {
background: #00ff00;
border-radius: 3px;
}
.output {
margin-bottom: 10px;
white-space: pre-wrap;
animation: glow 1.5s infinite alternate;
}
@keyframes glow {
from { text-shadow: 0 0 5px #00ff00; }
to { text-shadow: 0 0 10px #00ff00; }
}
.error {
color: #ff4444;
}
#input-container {
padding: 10px;
background: #111;
border-top: 2px solid #00ff00;
box-shadow: 0 -2px 10px #00ff00;
}
#prompt-input {
width: 100%;
background: #000;
color: #00ff00;
border: 1px solid #00ff00;
padding: 8px;
font-family: 'VT323', monospace;
font-size: 16px;
outline: none;
border-radius: 5px;
margin-bottom: 10px;
}
#prompt-input:focus {
box-shadow: 0 0 8px #00ff00;
}
#suggestions {
margin-bottom: 10px;
max-height: 140px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #00ff00 #111;
}
#suggestions::-webkit-scrollbar {
width: 6px;
}
#suggestions::-webkit-scrollbar-track {
background: #111;
}
#suggestions::-webkit-scrollbar-thumb {
background: #00ff00;
border-radius: 3px;
}
.suggestion {
background: #222;
padding: 5px;
margin: 5px 0;
border-radius: 3px;
cursor: pointer;
transition: background 0.2s;
}
.suggestion:hover {
background: #333;
}
button {
background: #00ff00;
color: #000;
border: none;
padding: 8px 15px;
font-family: 'VT323', monospace;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
transition: transform 0.2s;
margin-right: 10px;
}
button:last-child {
margin-right: 0;
}
button:active {
transform: scale(0.95);
}
#progress {
margin-bottom: 10px;
font-size: 14px;
color: #00cc00;
}
footer {
text-align: center;
padding: 10px;
background: #111;
border-top: 1px solid #00ff00;
font-size: 14px;
}
@media (max-width: 600px) {
header h1 { font-size: 20px; }
#prompt-input { font-size: 14px; padding: 10px; }
button { font-size: 14px; padding: 8px 12px; }
#console { padding: 10px; }
#progress { font-size: 12px; }
#suggestions { max-height: 120px; }
}
</style>
</head>
<body>
<header>
<h1>WebXOS ARCR: Prompt Architect</h1>
</header>
<div id="console">
<div class="output">Welcome to WebXOS ARCR! Create precise AI prompts using the ARCR system (Action > Role > Context > Response). Enter each component to build a structured prompt.</div>
</div>
<div id="input-container">
<div id="progress"></div>
<input type="text" id="prompt-input" placeholder="Enter your answer..." autocomplete="off">
<div id="suggestions"></div>
<button onclick="submitAnswer()">Submit</button>
<button onclick="clearConsole()">Clear</button>
<button onclick="showHelp()">Help</button>
</div>
<footer>
© 2025 WebXOS. All rights reserved.
</footer>
<script>
const consoleDiv = document.getElementById('console');
const promptInput = document.getElementById('prompt-input');
const suggestionsDiv = document.getElementById('suggestions');
const progressDiv = document.getElementById('progress');
let promptHistory = [];
let sessionLog = [];
// Initial state for questionState
const initialQuestionState = {
current: 'action',
answers: {
action: '',
role: '',
context: '',
response: '',
keywords: [],
expandedActions: [],
expandedRoles: [],
expandedContexts: [],
expandedResponses: []
}
};
let questionState = { ...initialQuestionState };
// Suggested Options
const actions = [
'compose', 'evaluate', 'generate', 'simulate', 'analyze', 'recommend',
'design', 'summarize', 'explain', 'predict', 'translate', 'brainstorm',
'modify', 'study', 'build', 'create', 'transcribe', 'edit', 'enhance',
'debug', 'test', 'research'
];
const roles = [
'educator', 'strategist', 'historian', 'ethicist', 'data scientist',
'creative writer', 'engineer', 'consultant', 'researcher', 'marketer',
'policy analyst', 'developer', 'artist', 'journalist', 'entrepreneur',
'therapist', 'futurist', 'cartoonist', 'doctor', 'scientist', 'mechanic',
'accountant', 'designer', 'mathematician'
];
const responseTypes = [
'narrative', 'image', 'report', 'diagram', 'policy brief', 'code',
'list', 'summary', 'plan', 'visualization', 'article', 'email',
'meme', 'story', 'essay', 'resume', 'poem', 'infographic', 'chart',
'website', 'sketch', 'digital art', 'cartoon', 'painting', 'program'
];
const visualResponses = ['image', 'cartoon', 'sketch', 'painting', 'chart'];
const contextExamples = {
educator: ['teaching a high school AI class', 'designing a STEM workshop'],
strategist: ['planning a corporate expansion', 'devising a marketing campaign'],
historian: ['analyzing 19th-century trade routes', 'researching ancient civilizations'],
ethicist: ['evaluating AI bias implications', 'assessing corporate ethics policies'],
'data scientist': ['modeling customer churn', 'analyzing genomic data'],
'creative writer': ['crafting a fantasy novel', 'writing a screenplay'],
engineer: ['optimizing a renewable energy system', 'designing a smart city infrastructure'],
consultant: ['advising on digital transformation', 'assessing supply chain efficiency'],
researcher: ['studying climate change impacts', 'investigating quantum computing'],
marketer: ['launching a social media campaign', 'analyzing consumer trends'],
'policy analyst': ['drafting environmental regulations', 'evaluating healthcare policies'],
developer: ['building a web application', 'debugging a machine learning pipeline'],
artist: ['creating a mural for a community center', 'designing a digital art installation'],
journalist: ['investigating local government policies', 'writing a feature on tech startups'],
entrepreneur: ['pitching a sustainable startup idea', 'developing a business model'],
therapist: ['counseling on stress management', 'designing a mental health workshop'],
futurist: ['predicting trends in AI development', 'envisioning sustainable cities in 2050'],
cartoonist: ['creating a comic strip for a magazine', 'designing characters for an animated series'],
doctor: ['diagnosing a patient with chronic symptoms', 'developing a public health campaign']
};
// Common Errors
const commonErrors = {
vague: ['detail', 'detail', 'detail']
};
// Stop Words for Keyword Filtering
const stopWords = [
'a', 'an', 'and', 'are', 'as', 'at', 'be', 'by', 'for', 'from',
'has', 'he', 'in', 'is', 'it', 'its', 'of', 'on', 'that', 'the',
'to', 'was', 'were', 'will', 'with'
];
function appendOutput(text, isError = false) {
const output = document.createElement('div');
output.className = 'output' + (isError ? ' error' : '');
output.textContent = text;
consoleDiv.appendChild(output);
consoleDiv.scrollTop = consoleDiv.scrollHeight;
sessionLog.push({ type: isError ? 'error' : 'output', text });
}
function showHelp() {
const helpText = `
WebXOS ARCR: How It Works
The ARCR system guides you to create precise AI prompts in four steps: Action, Role, Context, and Response.
1. **Action**: Choose what the AI should do (e.g., compose, analyze, modify, study).
2. **Role**: Define the AI's perspective (e.g., educator, developer, cartoonist, doctor).
3. **Context**: Provide specific details or scenarios (e.g., "teaching a class").
4. **Response**: Select the output type (e.g., narrative, code, sketch, digital art).
After building your prompt, you can expand it by adding more actions, roles, contexts, or responses. For visual outputs (image, cartoon, sketch, painting, chart), the AI will use DeepSearch and thinking logic. Prompts are copied to your clipboard.
Use buttons: Submit to answer, Clear to reset, Help for this guide.
`;
appendOutput(helpText);
}
function startQuestionSequence() {
questionState = { ...initialQuestionState };
consoleDiv.innerHTML = '<div class="output">Welcome to WebXOS ARCR! Create precise AI prompts using the ARCR system (Action > Role > Context > Response). Enter each component to build a structured prompt.</div>';
sessionLog = [{ type: 'output', text: 'Welcome to WebXOS ARCR! Create precise AI prompts using the ARCR system (Action > Role > Context > Response). Enter each component to build a structured prompt.' }];
suggestionsDiv.innerHTML = '';
promptInput.value = '';
updateProgress();
askQuestion();
}
function updateProgress() {
const steps = ['Action', 'Role', 'Context', 'Response'];
const currentIndex = ['action', 'role', 'context', 'response'].indexOf(questionState.current);
if (currentIndex >= 0) {
progressDiv.textContent = `Step ${currentIndex + 1}/4: ${steps[currentIndex]}`;
} else if (questionState.current === 'expand_prompt') {
progressDiv.textContent = `Expanding Prompt`;
} else if (questionState.current.startsWith('expand_')) {
const component = questionState.current.replace('expand_', '');
progressDiv.textContent = `Expanding ${component.charAt(0).toUpperCase() + component.slice(1)}`;
} else {
progressDiv.textContent = '';
}
}
function askQuestion() {
promptInput.value = '';
suggestionsDiv.innerHTML = '';
promptInput.focus();
if (questionState.current === 'action') {
promptInput.placeholder = "e.g., compose, evaluate, simulate, modify, study";
appendOutput(`Specify the action: ${actions.join(', ')}`);
suggestOptions(actions);
} else if (questionState.current === 'role') {
promptInput.placeholder = "e.g., artist, journalist, cartoonist, doctor";
appendOutput(`Define the role: ${roles.join(', ')}`);
suggestOptions(roles);
} else if (questionState.current === 'context') {
const role = questionState.answers.role.toLowerCase();
const examples = contextExamples[role] || ['in a specific scenario', 'with clear objectives'];
promptInput.placeholder = `e.g., ${examples[0]}`;
appendOutput(`Describe the context (examples: ${examples.join(', ')}):`);
} else if (questionState.current === 'response') {
promptInput.placeholder = "e.g., image, sketch, digital art, cartoon, painting, program";
appendOutput(`Choose the response type: ${responseTypes.join(', ')}`);
suggestOptions(responseTypes);
} else if (questionState.current === 'expand_prompt') {
promptInput.placeholder = "yes/no";
appendOutput(`Do you want to expand your prompt? (yes, no)`);
suggestOptions(['yes', 'no']);
} else if (questionState.current === 'expand_select') {
promptInput.placeholder = "action/role/context/response";
appendOutput(`What do you want to expand? (action, role, context, response)`);
suggestOptions(['action', 'role', 'context', 'response']);
} else if (questionState.current === 'expand_action') {
promptInput.placeholder = "e.g., compose, evaluate, simulate, modify, study";
appendOutput(`Specify the additional action: ${actions.join(', ')}`);
suggestOptions(actions);
} else if (questionState.current === 'expand_role') {
promptInput.placeholder = "e.g., artist, journalist, cartoonist, doctor";
appendOutput(`Define the additional role: ${roles.join(', ')}`);
suggestOptions(roles);
} else if (questionState.current === 'expand_context') {
const role = questionState.answers.role.toLowerCase();
const examples = contextExamples[role] || ['in a specific scenario', 'with clear objectives'];
promptInput.placeholder = `e.g., ${examples[0]}`;
appendOutput(`Describe the additional context (examples: ${examples.join(', ')}):`);
} else if (questionState.current === 'expand_response') {
promptInput.placeholder = "e.g., image, sketch, digital art, cartoon, painting, program";
appendOutput(`Choose the additional response type: ${responseTypes.join(', ')}`);
suggestOptions(responseTypes);
}
consoleDiv.scrollTop = consoleDiv.scrollHeight;
}
function suggestOptions(options) {
options.forEach(option => {
const div = document.createElement('div');
div.className = 'suggestion';
div.textContent = option;
div.onclick = () => {
promptInput.value = option;
submitAnswer();
};
suggestionsDiv.appendChild(div);
});
}
function validateAnswer(input) {
const normalizedInput = input.trim().toLowerCase();
if (!input.trim()) {
appendOutput('Error: Input cannot be empty.', true);
return false;
}
if (questionState.current === 'action' && !actions.includes(normalizedInput)) {
appendOutput(`Error: Select from: ${actions.join(', ')}`, true);
return false;
} else if (questionState.current === 'role' && !roles.includes(normalizedInput)) {
appendOutput(`Error: Select from: ${roles.join(', ')}`, true);
return false;
} else if (questionState.current === 'context' && input.trim().length < 10) {
appendOutput('Error: Context must be specific (10+ characters).', true);
return false;
} else if (questionState.current === 'response' && !responseTypes.includes(normalizedInput)) {
appendOutput(`Error: Select from: ${responseTypes.join(', ')}`, true);
return false;
} else if (questionState.current === 'expand_prompt' && !['yes', 'no'].includes(normalizedInput)) {
appendOutput(`Error: Please enter 'yes' or 'no'.`, true);
return false;
} else if (questionState.current === 'expand_select' && !['action', 'role', 'context', 'response'].includes(normalizedInput)) {
appendOutput(`Error: Select from: action, role, context, response`, true);
return false;
} else if (questionState.current === 'expand_action' && !actions.includes(normalizedInput)) {
appendOutput(`Error: Select from: ${actions.join(', ')}`, true);
return false;
} else if (questionState.current === 'expand_role' && !roles.includes(normalizedInput)) {
appendOutput(`Error: Select from: ${roles.join(', ')}`, true);
return false;
} else if (questionState.current === 'expand_context' && input.trim().length < 10) {
appendOutput('Error: Additional context must be specific (10+ characters).', true);
return false;
} else if (questionState.current === 'expand_response' && !responseTypes.includes(normalizedInput)) {
appendOutput(`Error: Select from: ${responseTypes.join(', ')}`, true);
return false;
}
if (commonErrors.vague.some(term => normalizedInput.includes(term))) {
appendOutput('Error: Avoid vague terms (e.g., "detail").', true);
return false;
}
return true;
}
function autocorrectInput(input) {
let corrected = input;
corrected = corrected.replace(/summary/gi, 'summary');
corrected = corrected.replace(/explain/gi, 'explain');
commonErrors.vague.forEach(term => {
corrected = corrected.replace(new RegExp(`\\b${term}\\b`, 'gi'), 'specific');
});
return corrected;
}
function extractKeywords(input) {
const words = input.toLowerCase()
.replace(/[.,!?;:'"()]/g, '')
.split(/\s+/);
const keywords = [...new Set(words.filter(word =>
word && !stopWords.includes(word) && word.length > 2
))];
return keywords;
}
function generatePrompt() {
const { action, role, context, response, keywords, expandedActions, expandedRoles, expandedContexts, expandedResponses } = questionState.answers;
let prompt = (
`The user has a request structured as Action > Role > Context > Response.\n` +
`As a ${role}, perform the following task:\n` +
`- **Action**: ${action}\n` +
`- **Context**: ${context}\n` +
`- **Keywords for DeepSearch**: ${keywords.join(', ') || 'none'} (use these to pretrain on relevant web data before processing)\n` +
`- **Response**: Deliver a ${response}\n`
);
if (visualResponses.includes(response.toLowerCase())) {
prompt += (
`\n**Visual Generation Instructions**: User requests visual generation. Use DeepSearch to gather relevant visual data and apply thinking logic to ensure high-quality output.\n`
);
}
// Only include expansions if they exist in the current session
const hasExpansions = expandedActions.length || expandedRoles.length || expandedContexts.length || expandedResponses.length;
if (hasExpansions) {
prompt += `\nExpanded Components:\n`;
if (expandedActions.length) {
prompt += `- **Additional Actions**: ${expandedActions.join(', ')}\n`;
}
if (expandedRoles.length) {
prompt += `- **Additional Roles**: ${expandedRoles.join(', ')}\n`;
}
if (expandedContexts.length) {
prompt += `- **Additional Contexts**: ${expandedContexts.join(', ')}\n`;
}
if (expandedResponses.length) {
prompt += `- **Additional Responses**: ${expandedResponses.join(', ')}\n`;
}
}
prompt += `\nGenerated by WebXOS ARCR 2025 (Copyright © 2025).`;
return prompt;
}
function submitAnswer() {
let input = promptInput.value.trim();
if (!input) {
appendOutput('Error: Input required.', true);
return;
}
try {
input = autocorrectInput(input);
if (questionState.current !== 'context' && questionState.current !== 'expand_context' && !validateAnswer(input)) {
return;
}
appendOutput(`> ${input}`);
sessionLog.push({ type: 'input', text: input });
if (questionState.current === 'action') {
questionState.answers.action = input;
questionState.current = 'role';
updateProgress();
askQuestion();
} else if (questionState.current === 'role') {
questionState.answers.role = input;
questionState.current = 'context';
updateProgress();
askQuestion();
} else if (questionState.current === 'context') {
if (!validateAnswer(input)) return;
questionState.answers.context = input;
questionState.answers.keywords = extractKeywords(input);
questionState.current = 'response';
updateProgress();
askQuestion();
} else if (questionState.current === 'response') {
questionState.answers.response = input;
const prompt = generatePrompt();
appendOutput(`Generated Prompt:\n${prompt}`);
copyToClipboard(prompt);
updateHistory(prompt);
questionState.current = 'expand_prompt';
updateProgress();
askQuestion();
} else if (questionState.current === 'expand_prompt') {
if (input.toLowerCase() === 'yes') {
questionState.current = 'expand_select';
} else {
appendOutput('Prompt expansion skipped.');
questionState.current = 'expand_prompt';
}
updateProgress();
askQuestion();
} else if (questionState.current === 'expand_select') {
questionState.current = `expand_${input.toLowerCase()}`;
updateProgress();
askQuestion();
} else if (questionState.current === 'expand_action') {
questionState.answers.expandedActions.push(input);
const prompt = generatePrompt();
appendOutput(`Updated Prompt with Additional Action:\n${prompt}`);
copyToClipboard(prompt);
updateHistory(prompt);
questionState.current = 'expand_prompt';
updateProgress();
askQuestion();
} else if (questionState.current === 'expand_role') {
questionState.answers.expandedRoles.push(input);
const prompt = generatePrompt();
appendOutput(`Updated Prompt with Additional Role:\n${prompt}`);
copyToClipboard(prompt);
updateHistory(prompt);
questionState.current = 'expand_prompt';
updateProgress();
askQuestion();
} else if (questionState.current === 'expand_context') {
if (!validateAnswer(input)) return;
questionState.answers.expandedContexts.push(input);
const prompt = generatePrompt();
appendOutput(`Updated Prompt with Additional Context:\n${prompt}`);
copyToClipboard(prompt);
updateHistory(prompt);
questionState.current = 'expand_prompt';
updateProgress();
askQuestion();
} else if (questionState.current === 'expand_response') {
questionState.answers.expandedResponses.push(input);
const prompt = generatePrompt();
appendOutput(`Updated Prompt with Additional Response:\n${prompt}`);
copyToClipboard(prompt);
updateHistory(prompt);
questionState.current = 'expand_prompt';
updateProgress();
askQuestion();
}
} catch (e) {
appendOutput(`Error processing input: ${e.message}`, true);
console.error('Submit error:', e);
}
}
function updateHistory(prompt) {
promptHistory.unshift({ prompt });
if (promptHistory.length > 5) promptHistory.pop();
sessionLog.push({ type: 'output', text: 'Prompt saved.' });
appendOutput('Prompt saved.');
}
function copyToClipboard(prompt) {
navigator.clipboard.writeText(prompt)
.then(() => {
appendOutput('Prompt copied!');
sessionLog.push({ type: 'output', text: 'Prompt copied!' });
})
.catch(() => {
appendOutput('Copy failed.', true);
sessionLog.push({ type: 'error', text: 'Copy failed.' });
});
}
function clearConsole() {
// Reset all states to initial values
promptHistory = [];
sessionLog = [];
questionState = {
current: 'action',
answers: {
action: '',
role: '',
context: '',
response: '',
keywords: [],
expandedActions: [],
expandedRoles: [],
expandedContexts: [],
expandedResponses: []
}
};
localStorage.removeItem('promptHistory');
// Clear UI elements
consoleDiv.innerHTML = '<div class="output">Welcome to WebXOS ARCR! Create precise AI prompts using the ARCR system (Action > Role > Context > Response). Enter each component to build a structured prompt.</div>';
promptInput.value = '';
suggestionsDiv.innerHTML = '';
progressDiv.textContent = 'Step 1/4: Action';
// Clear clipboard to prevent old prompt data
navigator.clipboard.writeText('')
.then(() => {
appendOutput('Console and state cleared. Ready for a new prompt.');
sessionLog.push({ type: 'output', text: 'Console and state cleared. Ready for a new prompt.' });
})
.catch(() => {
appendOutput('Console cleared, but clipboard reset failed.', true);
sessionLog.push({ type: 'error', text: 'Console cleared, but clipboard reset failed.' });
});
// Restart the question sequence
askQuestion();
}
promptInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
submitAnswer();
}
});
document.addEventListener('DOMContentLoaded', () => {
localStorage.removeItem('promptHistory');
setTimeout(startQuestionSequence, 100);
});
</script>
</body>
</html>