codebyam commited on
Commit
beb192a
Β·
verified Β·
1 Parent(s): aee3e45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +333 -40
app.py CHANGED
@@ -106,13 +106,98 @@ async def get_robots_txt():
106
  @app.get("/", response_class=HTMLResponse)
107
  async def read_items():
108
  html_content = """<!DOCTYPE html>
109
- <html lang="en">
110
- <head>
111
- <meta charset="UTF-8">
112
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
113
  <meta name="google-site-verification" content="-jY1rLSeurfpAp7kFipbI6puXHQ9Zqv8jYYpekEHfIo" />
114
  <meta name="msvalidate.01" content="550DC9E80C45FFA7BBF5B0F21D611E65" />
115
- <title>Prompt Optimizer Bot</title>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  <style>
117
  @import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,600;0,700;0,900;1,600&family=Inter:wght@400;500;600;700&family=Caveat:wght@600;700&display=swap');
118
 
@@ -139,7 +224,6 @@ async def read_items():
139
  font-family: 'Inter', sans-serif;
140
  max-width: 720px;
141
  min-height: 100vh;
142
- height: 100vh;
143
  display: flex;
144
  flex-direction: column;
145
  color: var(--ink);
@@ -176,6 +260,7 @@ async def read_items():
176
  font-size: 1.6rem;
177
  position: relative;
178
  letter-spacing: -0.02em;
 
179
  }
180
  .header .logo::after {
181
  content: "";
@@ -254,13 +339,82 @@ async def read_items():
254
  .chat-wrapper {
255
  display: flex;
256
  flex-direction: column;
257
- height: 100%;
258
- flex: 1;
259
  min-height: 0;
260
  position: relative;
261
  z-index: 1;
262
  }
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  .chat-window {
265
  flex: 1;
266
  overflow-y: auto;
@@ -467,28 +621,102 @@ async def read_items():
467
  }
468
  .modal-content {
469
  background-color: var(--paper);
470
- margin: 8% auto;
471
- padding: 24px 30px;
472
  border: 3px solid var(--ink);
473
- border-radius: 14px;
474
- width: 85%;
475
  max-width: 640px;
 
 
476
  text-align: left;
477
  box-shadow: 6px 6px 0 var(--ink);
478
  font-family: 'Inter', sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
479
  }
480
  .modal-content h1 {
481
  font-family: 'Fraunces', serif;
482
  font-weight: 900;
483
- margin-top: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
  .close {
486
  color: var(--ink-muted);
487
- float: right;
488
  font-size: 26px;
489
  font-weight: bold;
490
  cursor: pointer;
491
  line-height: 1;
 
 
 
492
  }
493
  .close:hover { color: var(--coral); }
494
 
@@ -521,6 +749,18 @@ async def read_items():
521
  40% { opacity: 1; }
522
  }
523
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  @media (max-width: 600px) {
525
  body { max-width: 100%; }
526
  .header { padding: 14px 16px; }
@@ -555,6 +795,17 @@ async def read_items():
555
  if (event.target == modal) modal.style.display = "none";
556
  };
557
 
 
 
 
 
 
 
 
 
 
 
 
558
  function formatTextWithLineBreaks(text) {
559
  const escaped = text
560
  .replace(/&/g, "&amp;")
@@ -661,7 +912,7 @@ async def read_items():
661
  async function loadHistory() {
662
  try {
663
  const result = localStorage.getItem(STORAGE_KEY);
664
- const messages = result[STORAGE_KEY] || [];
665
  messages.forEach((msg) =>
666
  appendMessage(msg.role, msg.text, { withCopy: msg.withCopy ?? (msg.role === "bot") })
667
  );
@@ -708,7 +959,9 @@ async def read_items():
708
  removeLoadingMessage();
709
  appendMessage(
710
  "bot",
711
- `🚨 Connection error: ${error.message}\n\nπŸ’‘ Tip: Make sure your optimization API is running and accessible.`
 
 
712
  );
713
  await saveHistory();
714
  }
@@ -733,51 +986,91 @@ async def read_items():
733
  <body>
734
  <div class="chat-wrapper">
735
  <div class="header">
736
- <div class="logo">Prompt Optimizer<span class="tag">✎ paper edition</span></div>
737
  <div class="header-actions">
738
  <div class="button" id="apiKeyBtn">Get API</div>
739
  <button id="clearBtn">🧹 Clear</button>
740
  </div>
741
  </div>
 
742
  <div id="chatWindow" class="chat-window">
743
  <div class="invite bot-message">
744
- <div class="avatar bot-avatar"><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 3v2.2" stroke="white" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="6.4" r="1.1" fill="white"/><rect x="5" y="8" width="14" height="10" rx="3" stroke="white" stroke-width="1.8"/><circle cx="9" cy="13" r="1.3" fill="white"/><circle cx="15" cy="13" r="1.3" fill="white"/><path d="M9 16.2h6" stroke="white" stroke-width="1.6" stroke-linecap="round"/></svg></div>
745
  <div class="bubble">
746
- Hi! Got a rough prompt? ✎ Paste it below β€” let's tighten it up.
747
  </div>
748
  </div>
749
  </div>
750
  <div class="input-bar">
751
- <textarea id="userInput" placeholder="Type or paste your prompt here..." rows="2"></textarea>
752
  <button id="sendButton" aria-label="Send message">➀</button>
753
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
754
  <div id="apiModal" class="modal">
755
  <div class="modal-content">
756
- <span class="close" id="closeModal">&times;</span>
757
- <h1>API Example</h1>
758
- <div>Integrate this tool in your projects. Start building cool tech.
759
-
760
- <h2>Python Code Snippet</h2>
761
- <pre><code>
762
- import requests
763
- url = "https://codebyam-prompt-optimizer.hf.space/optimize"
764
- data = {"input_prompt": "This is my sample prompt."}
 
 
 
765
  response = requests.post(url, json=data)
766
- print(response.json())
767
- </code></pre>
 
768
 
769
- <h2>JavaScript Code Snippet</h2>
770
- <pre><code>
771
- const API_ENDPOINT = "https://codebyam-prompt-optimizer.hf.space/optimize";
772
  const response = await fetch(API_ENDPOINT, {
773
- method: "POST",
774
- headers: { "Content-Type": "application/json" },
775
  body: JSON.stringify({ input_prompt: prompt }),
776
- })
777
- </code></pre>
 
 
778
  </div>
779
  </div>
780
  </div>
781
- </body>
782
- </html>"""
783
  return html_content
 
106
  @app.get("/", response_class=HTMLResponse)
107
  async def read_items():
108
  html_content = """<!DOCTYPE html>
109
+ <html lang="en"><head>
110
+ <meta charset="UTF-8" />
111
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
112
  <meta name="google-site-verification" content="-jY1rLSeurfpAp7kFipbI6puXHQ9Zqv8jYYpekEHfIo" />
113
  <meta name="msvalidate.01" content="550DC9E80C45FFA7BBF5B0F21D611E65" />
114
+
115
+ <!-- Primary SEO meta tags -->
116
+ <title>Prompt Optimizer β€” Paste a Rough Prompt, Get It Fixed in Seconds (Free, No Sign-Up)</title>
117
+ <meta name="description" content="Got a messy prompt? Paste it in and Prompt Optimizer rewrites it into something clear and specific in seconds β€” no account, no templates to fill out, no signup. Works for ChatGPT, Claude, Gemini, and any AI model." />
118
+ <meta name="author" content="Prompt Optimizer Bot" />
119
+ <meta name="robots" content="index, follow" />
120
+ <link rel="canonical" href="https://codebyam-prompt-optimizer.hf.space/" />
121
+ <meta name="theme-color" content="#3D5AFE" />
122
+
123
+ <!-- Open Graph / Facebook -->
124
+ <meta property="og:type" content="website" />
125
+ <meta property="og:title" content="Prompt Optimizer β€” Paste a Rough Prompt, Get It Fixed in Seconds" />
126
+ <meta property="og:description" content="No templates, no signup, no fuss. Paste your rough prompt, get back a clearer, more specific one β€” instantly. Works with ChatGPT, Claude, Gemini, and any AI model." />
127
+ <meta property="og:url" content="https://codebyam-prompt-optimizer.hf.space/" />
128
+ <meta property="og:site_name" content="Prompt Optimizer Bot" />
129
+ <meta property="og:image" content="https://codebyam-prompt-optimizer.hf.space/og-image.png" />
130
+ <meta property="og:locale" content="en_US" />
131
+
132
+ <!-- Twitter Card -->
133
+ <meta name="twitter:card" content="summary_large_image" />
134
+ <meta name="twitter:title" content="Prompt Optimizer β€” Paste a Rough Prompt, Get It Fixed in Seconds" />
135
+ <meta name="twitter:description" content="No templates, no signup, no fuss. Paste your rough prompt, get back a clearer, more specific one β€” instantly." />
136
+ <meta name="twitter:image" content="https://codebyam-prompt-optimizer.hf.space/og-image.png" />
137
+
138
+ <!-- Favicon -->
139
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Crect width='24' height='24' rx='6' fill='%233D5AFE'/%3E%3Cpath d='M12 5v2.2' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='8.4' r='1.1' fill='white'/%3E%3Crect x='5' y='10' width='14' height='9' rx='3' stroke='white' stroke-width='1.8'/%3E%3Ccircle cx='9' cy='14.5' r='1.2' fill='white'/%3E%3Ccircle cx='15' cy='14.5' r='1.2' fill='white'/%3E%3C/svg%3E" />
140
+
141
+ <!-- Structured data: WebApplication schema -->
142
+ <script type="application/ld+json">
143
+ {
144
+ "@context": "https://schema.org",
145
+ "@type": "WebApplication",
146
+ "name": "Prompt Optimizer Bot",
147
+ "url": "https://codebyam-prompt-optimizer.hf.space/",
148
+ "description": "Paste a rough AI prompt and get back a clearer, more specific version in seconds. No signup, no templates, no account required.",
149
+ "applicationCategory": "Utility",
150
+ "operatingSystem": "Any",
151
+ "offers": {
152
+ "@type": "Offer",
153
+ "price": "0",
154
+ "priceCurrency": "USD"
155
+ }
156
+ }
157
+ </script>
158
+
159
+ <!-- Structured data: FAQPage schema, mirrors the visible FAQ section in the page body -->
160
+ <script type="application/ld+json">
161
+ {
162
+ "@context": "https://schema.org",
163
+ "@type": "FAQPage",
164
+ "mainEntity": [
165
+ {
166
+ "@type": "Question",
167
+ "name": "Is Prompt Optimizer free to use?",
168
+ "acceptedAnswer": {
169
+ "@type": "Answer",
170
+ "text": "Yes. Prompt Optimizer is completely free, with no account or signup required. Just paste your prompt and get an optimized version back."
171
+ }
172
+ },
173
+ {
174
+ "@type": "Question",
175
+ "name": "Which AI models does the optimized prompt work with?",
176
+ "acceptedAnswer": {
177
+ "@type": "Answer",
178
+ "text": "The optimized prompt is model-agnostic, so it works well with ChatGPT, Claude, Gemini, and most other large language models."
179
+ }
180
+ },
181
+ {
182
+ "@type": "Question",
183
+ "name": "Do I need to fill out a template or form?",
184
+ "acceptedAnswer": {
185
+ "@type": "Answer",
186
+ "text": "No. Unlike many prompt tools, there is no template picker or form to fill out. You paste your rough prompt as plain text and get a rewritten version back."
187
+ }
188
+ },
189
+ {
190
+ "@type": "Question",
191
+ "name": "What does a prompt optimizer actually do?",
192
+ "acceptedAnswer": {
193
+ "@type": "Answer",
194
+ "text": "It takes a vague or incomplete prompt and rewrites it to add missing structure, such as clearer intent, constraints, tone, and format, so the AI model produces a more accurate and useful response."
195
+ }
196
+ }
197
+ ]
198
+ }
199
+ </script>
200
+
201
  <style>
202
  @import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,600;0,700;0,900;1,600&family=Inter:wght@400;500;600;700&family=Caveat:wght@600;700&display=swap');
203
 
 
224
  font-family: 'Inter', sans-serif;
225
  max-width: 720px;
226
  min-height: 100vh;
 
227
  display: flex;
228
  flex-direction: column;
229
  color: var(--ink);
 
260
  font-size: 1.6rem;
261
  position: relative;
262
  letter-spacing: -0.02em;
263
+ margin: 0;
264
  }
265
  .header .logo::after {
266
  content: "";
 
339
  .chat-wrapper {
340
  display: flex;
341
  flex-direction: column;
342
+ height: 100vh;
343
+ flex-shrink: 0;
344
  min-height: 0;
345
  position: relative;
346
  z-index: 1;
347
  }
348
 
349
+ /* SEO content: collapsed by default (native <details>), sits below the
350
+ fixed-height chat app. Closed state is a single toggle line β€” the
351
+ chat UI above is completely unaffected either way. */
352
+ .seo-content {
353
+ display: none;
354
+ background: var(--paper);
355
+ padding: 14px 24px 20px;
356
+ border-top: 3px solid var(--ink);
357
+ position: relative;
358
+ z-index: 1;
359
+ }
360
+ .seo-content > summary {
361
+ font-family: 'Inter', sans-serif;
362
+ font-weight: 700;
363
+ font-size: 0.85em;
364
+ color: var(--ink-muted);
365
+ cursor: pointer;
366
+ list-style: none;
367
+ padding: 6px 0;
368
+ user-select: none;
369
+ }
370
+ .seo-content > summary::-webkit-details-marker { display: none; }
371
+ .seo-content > summary::before {
372
+ content: "β–Έ ";
373
+ display: inline-block;
374
+ transition: transform 0.15s ease;
375
+ }
376
+ .seo-content[open] > summary::before {
377
+ transform: rotate(90deg);
378
+ }
379
+ .seo-content .accordion-body {
380
+ padding-top: 18px;
381
+ }
382
+ .seo-heading {
383
+ font-family: 'Fraunces', serif;
384
+ font-weight: 700;
385
+ font-size: 1.3rem;
386
+ border-bottom: 2px solid var(--ink);
387
+ padding-bottom: 6px;
388
+ margin: 0 0 16px;
389
+ }
390
+ .seo-content .how-it-works {
391
+ margin: 0 0 36px;
392
+ padding-left: 22px;
393
+ line-height: 1.6;
394
+ }
395
+ .seo-content .how-it-works li { margin-bottom: 10px; }
396
+ .faq-item {
397
+ background: white;
398
+ border: 2px solid var(--ink);
399
+ border-radius: 12px;
400
+ box-shadow: 3px 3px 0 var(--shadow);
401
+ padding: 14px 18px;
402
+ margin-bottom: 14px;
403
+ }
404
+ .faq-item h3 {
405
+ font-family: 'Inter', sans-serif;
406
+ font-size: 1rem;
407
+ margin: 0 0 6px;
408
+ }
409
+ .faq-item p {
410
+ margin: 0;
411
+ line-height: 1.55;
412
+ color: var(--ink);
413
+ }
414
+ @media (max-width: 600px) {
415
+ .seo-content { padding: 10px 16px 16px; }
416
+ }
417
+
418
  .chat-window {
419
  flex: 1;
420
  overflow-y: auto;
 
621
  }
622
  .modal-content {
623
  background-color: var(--paper);
624
+ margin: 6% auto;
625
+ padding: 0;
626
  border: 3px solid var(--ink);
627
+ border-radius: 16px;
628
+ width: 90%;
629
  max-width: 640px;
630
+ max-height: 84vh;
631
+ overflow-y: auto;
632
  text-align: left;
633
  box-shadow: 6px 6px 0 var(--ink);
634
  font-family: 'Inter', sans-serif;
635
+ position: relative;
636
+ }
637
+ .modal-header {
638
+ display: flex;
639
+ align-items: center;
640
+ justify-content: space-between;
641
+ padding: 20px 26px 14px;
642
+ border-bottom: 3px solid var(--ink);
643
+ background: var(--paper);
644
+ position: sticky;
645
+ top: 0;
646
+ z-index: 1;
647
  }
648
  .modal-content h1 {
649
  font-family: 'Fraunces', serif;
650
  font-weight: 900;
651
+ margin: 0;
652
+ font-size: 1.5rem;
653
+ position: relative;
654
+ }
655
+ .modal-body {
656
+ padding: 22px 26px 28px;
657
+ }
658
+ .modal-tagline {
659
+ font-family: 'Caveat', cursive;
660
+ font-weight: 700;
661
+ font-size: 1.15rem;
662
+ color: var(--coral);
663
+ transform: rotate(-1deg);
664
+ display: inline-block;
665
+ margin: 0 0 20px;
666
  }
667
+ .modal-content .sticky-tag {
668
+ font-family: 'Caveat', cursive;
669
+ font-weight: 700;
670
+ font-size: 1.15rem;
671
+ background: var(--marigold);
672
+ color: var(--ink);
673
+ display: inline-block;
674
+ padding: 3px 14px 5px 12px;
675
+ border: 2px solid var(--ink);
676
+ border-radius: 8px;
677
+ transform: rotate(-1deg);
678
+ margin: 0 0 10px;
679
+ }
680
+ .code-block {
681
+ background: var(--paper-2);
682
+ border: 2px solid var(--ink);
683
+ border-radius: 12px;
684
+ box-shadow: 3px 3px 0 var(--shadow);
685
+ padding: 0;
686
+ margin-bottom: 20px;
687
+ overflow: hidden;
688
+ }
689
+ .code-block pre {
690
+ background: transparent;
691
+ border: none;
692
+ border-radius: 0;
693
+ margin: 0;
694
+ padding: 14px 16px;
695
+ }
696
+ .code-block .copy-code-btn {
697
+ background-color: var(--green);
698
+ color: white;
699
+ border: none;
700
+ border-top: 2px solid var(--ink);
701
+ border-radius: 0;
702
+ width: 100%;
703
+ padding: 8px 14px;
704
+ font-size: 0.82em;
705
+ font-weight: 700;
706
+ font-family: 'Inter', sans-serif;
707
+ cursor: pointer;
708
+ transition: background-color 0.12s ease;
709
+ }
710
+ .code-block .copy-code-btn:hover { background-color: #3f9c6c; }
711
  .close {
712
  color: var(--ink-muted);
 
713
  font-size: 26px;
714
  font-weight: bold;
715
  cursor: pointer;
716
  line-height: 1;
717
+ background: none;
718
+ border: none;
719
+ padding: 0 4px;
720
  }
721
  .close:hover { color: var(--coral); }
722
 
 
749
  40% { opacity: 1; }
750
  }
751
 
752
+ /* Visually-hidden helper for SEO-friendly semantic content
753
+ that shouldn't alter the existing visual design */
754
+ .visually-hidden {
755
+ position: absolute !important;
756
+ width: 1px; height: 1px;
757
+ padding: 0; margin: -1px;
758
+ overflow: hidden;
759
+ clip: rect(0, 0, 0, 0);
760
+ white-space: nowrap;
761
+ border: 0;
762
+ }
763
+
764
  @media (max-width: 600px) {
765
  body { max-width: 100%; }
766
  .header { padding: 14px 16px; }
 
795
  if (event.target == modal) modal.style.display = "none";
796
  };
797
 
798
+ modal.querySelectorAll(".copy-code-btn").forEach((codeBtn) => {
799
+ codeBtn.addEventListener("click", () => {
800
+ const codeEl = codeBtn.parentElement.querySelector("code");
801
+ const codeText = codeEl ? codeEl.innerText : "";
802
+ navigator.clipboard.writeText(codeText);
803
+ const originalLabel = codeBtn.textContent;
804
+ codeBtn.textContent = "Copied!";
805
+ setTimeout(() => (codeBtn.textContent = originalLabel), 1500);
806
+ });
807
+ });
808
+
809
  function formatTextWithLineBreaks(text) {
810
  const escaped = text
811
  .replace(/&/g, "&amp;")
 
912
  async function loadHistory() {
913
  try {
914
  const result = localStorage.getItem(STORAGE_KEY);
915
+ const messages = result ? JSON.parse(result) : [];
916
  messages.forEach((msg) =>
917
  appendMessage(msg.role, msg.text, { withCopy: msg.withCopy ?? (msg.role === "bot") })
918
  );
 
959
  removeLoadingMessage();
960
  appendMessage(
961
  "bot",
962
+ `🚨 Connection error: ${error.message}
963
+
964
+ πŸ’‘ Tip: Make sure your optimization API is running and accessible.`
965
  );
966
  await saveHistory();
967
  }
 
986
  <body>
987
  <div class="chat-wrapper">
988
  <div class="header">
989
+ <h1 class="logo">Prompt Optimizer<span class="tag">✎ paper edition</span></h1>
990
  <div class="header-actions">
991
  <div class="button" id="apiKeyBtn">Get API</div>
992
  <button id="clearBtn">🧹 Clear</button>
993
  </div>
994
  </div>
995
+
996
  <div id="chatWindow" class="chat-window">
997
  <div class="invite bot-message">
998
+ <div class="avatar bot-avatar"><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 3v2.2" stroke="white" stroke-width="1.8" stroke-linecap="round"></path><circle cx="12" cy="6.4" r="1.1" fill="white"></circle><rect x="5" y="8" width="14" height="10" rx="3" stroke="white" stroke-width="1.8"></rect><circle cx="9" cy="13" r="1.3" fill="white"></circle><circle cx="15" cy="13" r="1.3" fill="white"></circle><path d="M9 16.2h6" stroke="white" stroke-width="1.6" stroke-linecap="round"></path></svg></div>
999
  <div class="bubble">
1000
+ Hi! Got a rough prompt? ✎ Paste it below β€” let&#39;s tighten it up.
1001
  </div>
1002
  </div>
1003
  </div>
1004
  <div class="input-bar">
1005
+ <textarea id="userInput" placeholder="Type or paste your prompt here..." rows="2" aria-label="Enter your prompt to optimize"></textarea>
1006
  <button id="sendButton" aria-label="Send message">➀</button>
1007
  </div>
1008
+
1009
+ <!-- Crawlable SEO content: real copy, but collapsed by default via native
1010
+ <details>. The chat UI above is completely unchanged; this only shows
1011
+ a small toggle line unless the user taps it open. -->
1012
+ <details class="seo-content">
1013
+ <summary>How it works &amp; FAQ</summary>
1014
+ <div class="accordion-body">
1015
+ <h2 class="seo-heading">How Prompt Optimizer works</h2>
1016
+ <ol class="how-it-works">
1017
+ <li><strong>Paste your rough prompt.</strong> No template to pick, no form fields β€” just plain text, exactly as messy as it already is.</li>
1018
+ <li><strong>Get a rewritten version back.</strong> The tool adds the missing structure: clearer intent, constraints, tone, and format.</li>
1019
+ <li><strong>Copy and use it anywhere.</strong> The optimized prompt works with ChatGPT, Claude, Gemini, or any other AI model.</li>
1020
+ </ol>
1021
+
1022
+ <h2 class="seo-heading">Frequently asked questions</h2>
1023
+ <div class="faq-item">
1024
+ <h3>Is Prompt Optimizer free to use?</h3>
1025
+ <p>Yes. It's completely free, with no account or signup required. Just paste your prompt and get an optimized version back.</p>
1026
+ </div>
1027
+ <div class="faq-item">
1028
+ <h3>Which AI models does the optimized prompt work with?</h3>
1029
+ <p>The optimized prompt is model-agnostic, so it works well with ChatGPT, Claude, Gemini, and most other large language models.</p>
1030
+ </div>
1031
+ <div class="faq-item">
1032
+ <h3>Do I need to fill out a template or form?</h3>
1033
+ <p>No. Unlike many prompt tools, there's no template picker or form to fill out. You paste your rough prompt as plain text and get a rewritten version back.</p>
1034
+ </div>
1035
+ <div class="faq-item">
1036
+ <h3>What does a prompt optimizer actually do?</h3>
1037
+ <p>It takes a vague or incomplete prompt and rewrites it to add missing structure β€” clearer intent, constraints, tone, and format β€” so the AI model produces a more accurate and useful response.</p>
1038
+ </div>
1039
+ </div>
1040
+ </details>
1041
  <div id="apiModal" class="modal">
1042
  <div class="modal-content">
1043
+ <div class="modal-header">
1044
+ <h1>Get API ✎</h1>
1045
+ <button class="close" id="closeModal" aria-label="Close">Γ—</button>
1046
+ </div>
1047
+ <div class="modal-body">
1048
+ <p>Integrate this tool in your own projects</p>
1049
+
1050
+ <span class="sticky-tag">Python</span>
1051
+ <div class="code-block">
1052
+ <pre><code>import requests
1053
+ url = &quot;https://codebyam-prompt-optimizer.hf.space/optimize&quot;
1054
+ data = {&quot;input_prompt&quot;: &quot;This is my sample prompt.&quot;}
1055
  response = requests.post(url, json=data)
1056
+ print(response.json())</code></pre>
1057
+ <button class="copy-code-btn" data-copy-target="pyCode">Copy</button>
1058
+ </div>
1059
 
1060
+ <span class="sticky-tag">JavaScript</span>
1061
+ <div class="code-block">
1062
+ <pre><code>const API_ENDPOINT = &quot;https://codebyam-prompt-optimizer.hf.space/optimize&quot;;
1063
  const response = await fetch(API_ENDPOINT, {
1064
+ method: &quot;POST&quot;,
1065
+ headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
1066
  body: JSON.stringify({ input_prompt: prompt }),
1067
+ })</code></pre>
1068
+ <button class="copy-code-btn" data-copy-target="jsCode">Copy</button>
1069
+ </div>
1070
+ </div>
1071
  </div>
1072
  </div>
1073
  </div>
1074
+
1075
+ </div></body></html>"""
1076
  return html_content