AeroVortex commited on
Commit
255ec39
·
verified ·
1 Parent(s): 7b4100c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +10 -60
index.html CHANGED
@@ -4,57 +4,30 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Open-Generative-AI Studio</title>
7
- <script src="https://js.puter.com/v2/"></script>
8
  </head>
9
  <body style="margin: 0; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-color: #0b0b0f; color: #f1f1f3;">
10
  <div style="max-width: 650px; margin: 30px auto; background: #16161e; padding: 24px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); border: 1px solid #2d2d3d;">
11
 
12
  <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
13
  <h2 style="margin: 0; color: #fff; font-size: 20px;">Open-Generative-AI Studio</h2>
14
- <button id="authBtn" onclick="handleAuth()" style="background: #2563eb; color: #fff; border: none; padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;">Sign In / Connect</button>
15
  </div>
16
 
17
  <div style="margin-bottom: 16px;">
18
- <label style="display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: #a1a1aa;">Prompt / Description</label>
19
- <textarea id="promptInput" rows="3" placeholder="Describe the image or content you want to generate..." style="width: 100%; padding: 10px; box-sizing: border-box; background: #0b0b0f; border: 1px solid #2d2d3d; color: #fff; border-radius: 6px; font-size: 14px;"></textarea>
20
  </div>
21
 
22
- <div style="display: flex; gap: 10px; margin-bottom: 20px;">
23
- <button onclick="generateImage()" style="flex: 1; background: #7c3aed; color: #fff; border: none; padding: 10px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer;">Generate Image</button>
24
- <button onclick="generateText()" style="flex: 1; background: #2563eb; color: #fff; border: none; padding: 10px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer;">Ask AI</button>
25
- </div>
26
 
27
- <label style="display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: #a1a1aa;">Output Result</label>
28
- <div id="outputArea" style="padding: 16px; background: #0b0b0f; border: 1px solid #2d2d3d; border-radius: 6px; min-height: 100px; font-size: 14px; color: #d4d4d8; text-align: center; display: flex; align-items: center; justify-content: center;">
29
  Ready for input...
30
  </div>
31
  </div>
32
 
33
  <script>
34
- window.addEventListener('DOMContentLoaded', async () => {
35
- try {
36
- if (puter.auth.isSignedIn()) {
37
- document.getElementById('authBtn').innerText = "Connected";
38
- }
39
- } catch (e) {
40
- console.log("Auth check skipped");
41
- }
42
- });
43
-
44
- async function handleAuth() {
45
- try {
46
- document.getElementById('authBtn').innerText = "Connecting...";
47
- // Attempt standard sign-in popup
48
- await puter.auth.signIn();
49
- document.getElementById('authBtn').innerText = "Connected";
50
- } catch (err) {
51
- console.error(err);
52
- document.getElementById('authBtn').innerText = "Sign In Failed";
53
- alert("Popup was blocked or closed. Tip: Log into puter.com in another tab first, then return here and try again.");
54
- }
55
- }
56
-
57
- async function generateImage() {
58
  const prompt = document.getElementById('promptInput').value;
59
  const output = document.getElementById('outputArea');
60
 
@@ -63,34 +36,11 @@
63
  return;
64
  }
65
 
66
- output.innerHTML = "Generating image...";
67
- try {
68
- const imgElement = await puter.ai.txt2img(prompt);
69
- output.innerHTML = "";
70
- imgElement.style.maxWidth = "100%";
71
- imgElement.style.borderRadius = "6px";
72
- output.appendChild(imgElement);
73
- } catch (err) {
74
- output.innerText = "Error: Please sign in first or check connection. (" + err + ")";
75
- }
76
  }
77
 
78
- async function generateText() {
79
- const prompt = document.getElementById('promptInput').value;
80
- const output = document.getElementById('outputArea');
81
-
82
- if (!prompt.trim()) {
83
- output.innerText = "Please enter a prompt first.";
84
- return;
85
- }
86
-
87
- output.innerHTML = "Thinking...";
88
- try {
89
- const response = await puter.ai.chat(prompt);
90
- output.innerHTML = `<div style="text-align: left; width: 100%; white-space: pre-wrap;">${response}</div>`;
91
- } catch (err) {
92
- output.innerText = "Error: Please sign in first or check connection. (" + err + ")";
93
- }
94
  }
95
  </script>
96
  </body>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Open-Generative-AI Studio</title>
 
7
  </head>
8
  <body style="margin: 0; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-color: #0b0b0f; color: #f1f1f3;">
9
  <div style="max-width: 650px; margin: 30px auto; background: #16161e; padding: 24px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); border: 1px solid #2d2d3d;">
10
 
11
  <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
12
  <h2 style="margin: 0; color: #fff; font-size: 20px;">Open-Generative-AI Studio</h2>
13
+ <span style="background: #10b981; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;">Static Mode</span>
14
  </div>
15
 
16
  <div style="margin-bottom: 16px;">
17
+ <label style="display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: #a1a1aa;">Creative Prompt</label>
18
+ <textarea id="promptInput" rows="3" placeholder="Describe a scene, character, mood, or style..." style="width: 100%; padding: 10px; box-sizing: border-box; background: #0b0b0f; border: 1px solid #2d2d3d; color: #fff; border-radius: 6px; font-size: 14px;"></textarea>
19
  </div>
20
 
21
+ <button onclick="handleGenerate()" style="background: #2563eb; color: #fff; border: none; padding: 12px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; width: 100%; margin-bottom: 20px;">Generate Studio Output</button>
 
 
 
22
 
23
+ <label style="display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: #a1a1aa;">Output Panel</label>
24
+ <div id="outputArea" style="padding: 16px; background: #0b0b0f; border: 1px solid #2d2d3d; border-radius: 6px; min-height: 80px; font-size: 14px; color: #d4d4d8; display: flex; align-items: center; justify-content: center; text-align: center;">
25
  Ready for input...
26
  </div>
27
  </div>
28
 
29
  <script>
30
+ function handleGenerate() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  const prompt = document.getElementById('promptInput').value;
32
  const output = document.getElementById('outputArea');
33
 
 
36
  return;
37
  }
38
 
39
+ output.innerHTML = "Processed static request for: <br><b style='color:#60a5fa; margin-top:5px; display:block;'>" + escapeHtml(prompt) + "</b>";
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
+ function escapeHtml(text) {
43
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
  </script>
46
  </body>