home.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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>G4F GUI</title>
  7. <style>
  8. :root {
  9. --colour-1: #000000;
  10. --colour-2: #ccc;
  11. --colour-3: #e4d4ff;
  12. --colour-4: #f0f0f0;
  13. --colour-5: #181818;
  14. --colour-6: #242424;
  15. --accent: #8b3dff;
  16. --gradient: #1a1a1a;
  17. --background: #16101b;
  18. --size: 70vw;
  19. --top: 50%;
  20. --blur: 40px;
  21. --opacity: 0.6;
  22. }
  23. @import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
  24. .gradient {
  25. position: absolute;
  26. z-index: -1;
  27. left: 50vw;
  28. border-radius: 50%;
  29. background: radial-gradient(circle at center, var(--accent), var(--gradient));
  30. width: var(--size);
  31. height: var(--size);
  32. top: var(--top);
  33. transform: translate(-50%, -50%);
  34. filter: blur(var(--blur)) opacity(var(--opacity));
  35. animation: zoom_gradient 6s infinite alternate;
  36. display: none;
  37. max-height: 100%;
  38. transition: max-height 0.25s ease-in;
  39. }
  40. .gradient.hidden {
  41. max-height: 0;
  42. transition: max-height 0.15s ease-out;
  43. }
  44. @media only screen and (min-width: 40em) {
  45. body .gradient{
  46. display: block;
  47. }
  48. }
  49. @keyframes zoom_gradient {
  50. 0% {
  51. transform: translate(-50%, -50%) scale(1);
  52. }
  53. 100% {
  54. transform: translate(-50%, -50%) scale(1.2);
  55. }
  56. }
  57. /* Body and text color */
  58. body {
  59. background: var(--background);
  60. color: var(--colour-3);
  61. font-family: "Inter", sans-serif;
  62. height: 100vh;
  63. margin: 0;
  64. padding: 0;
  65. overflow: hidden;
  66. font-weight: bold;
  67. }
  68. /* Container for the main content */
  69. .container {
  70. display: flex;
  71. flex-direction: column;
  72. justify-content: center;
  73. align-items: center;
  74. height: 100%;
  75. text-align: center;
  76. z-index: 1;
  77. }
  78. header {
  79. font-size: 3rem;
  80. text-transform: uppercase;
  81. margin: 20px;
  82. color: var(--colour-4);
  83. }
  84. iframe {
  85. background: transparent;
  86. width: 100%;
  87. border: none;
  88. }
  89. #background {
  90. height: 100%;
  91. position: absolute;
  92. z-index: -1;
  93. }
  94. iframe.stream {
  95. max-height: 0;
  96. transition: max-height 0.15s ease-out;
  97. }
  98. iframe.stream.show {
  99. max-height: 1000px;
  100. height: 1000px;
  101. transition: max-height 0.25s ease-in;
  102. background: rgba(255,255,255,0.7);
  103. border-top: 2px solid rgba(255,255,255,0.5);
  104. }
  105. .description {
  106. font-size: 1.2rem;
  107. margin-bottom: 30px;
  108. color: var(--colour-2);
  109. } return app
  110. .input-field {
  111. width: 80%;
  112. max-width: 400px;
  113. padding: 12px;
  114. margin: 10px 0;
  115. border: 2px solid var(--colour-6);
  116. background-color: var(--colour-5);
  117. color: var(--colour-3);
  118. border-radius: 8px;
  119. font-size: 1.1rem;
  120. }
  121. .input-field:focus {
  122. outline: none;
  123. border-color: var(--accent);
  124. }
  125. .button {
  126. background-color: var(--accent);
  127. color: var(--colour-3);
  128. border: none;
  129. padding: 15px 30px;
  130. font-size: 1.1rem;
  131. border-radius: 8px;
  132. cursor: pointer;
  133. transition: background-color 0.3s ease;
  134. margin-top: 15px;
  135. width: 100%;
  136. max-width: 400px;
  137. font-weight: bold;
  138. }
  139. .button:hover {
  140. background-color: #7a2ccd;
  141. }
  142. .footer {
  143. margin-top: 30px;
  144. font-size: 0.9rem;
  145. color: var(--colour-2);
  146. }
  147. /* Animation for the gradient circle */
  148. @keyframes zoom_gradient {
  149. 0% {
  150. transform: translate(-50%, -50%) scale(1);
  151. }
  152. 100% {
  153. transform: translate(-50%, -50%) scale(1.5);
  154. }
  155. }
  156. </style>
  157. <script src="https://cdn.jsdelivr.net/npm/markdown-it@13.0.1/dist/markdown-it.min.js"></script>
  158. </head>
  159. <body>
  160. <iframe id="background"></iframe>
  161. <!-- Gradient Background Circle -->
  162. <div class="gradient"></div>
  163. <!-- Main Content -->
  164. <div class="container">
  165. <header>
  166. G4F GUI
  167. </header>
  168. <div class="description">
  169. Welcome to the G4F GUI! <br>
  170. Your AI assistant is ready to assist you.
  171. </div>
  172. <!-- Input and Button -->
  173. <form action="/chat/">
  174. <!--
  175. <input type="text" name="prompt" class="input-field" placeholder="Enter your query...">
  176. -->
  177. <button class="button">Open Chat</button>
  178. </form>
  179. <!-- Footer -->
  180. <div class="footer">
  181. <p>&copy; 2025 G4F. All Rights Reserved.</p>
  182. <p>Powered by the G4F framework</p>
  183. </div>
  184. <iframe id="stream-widget" class="stream" frameborder="0"></iframe>
  185. </div>
  186. <script>
  187. const iframe = document.getElementById('stream-widget');""
  188. let search = (navigator.language == "de" ? "news in deutschland" : navigator.language == "en" ? "world news" : navigator.language);
  189. if (Math.floor(Math.random() * 6) % 2 == 0) {
  190. search = "xtekky/gpt4free releases";
  191. }
  192. const url = "/backend-api/v2/create?prompt=Create of overview of the news in plain text&stream=1&web_search=" + search;
  193. iframe.src = url;
  194. setTimeout(()=>iframe.classList.add('show'), 3000);
  195. iframe.onload = () => {
  196. const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
  197. const iframeBody = iframeDocument.querySelector("body");
  198. const iframeContent = iframeDocument.querySelector("pre");
  199. const markdown = window.markdownit();
  200. iframeBody.innerHTML = markdown.render(iframeContent.innerHTML);
  201. }
  202. (async () => {
  203. const prompt = `
  204. Today is ${new Date().toJSON().slice(0, 10)}.
  205. Create a single-page HTML screensaver reflecting the current season (based on the date).
  206. For example, if it's Spring, it might use floral patterns or pastel colors.
  207. Avoid using any text. Consider a subtle animation or transition effect.`;
  208. const response = await fetch(`/backend-api/v2/create?prompt=${prompt}&filter_markdown=html`)
  209. const text = await response.text()
  210. background.src = `data:text/html;charset=utf-8,${encodeURIComponent(text)}`;
  211. const gradient = document.querySelector('.gradient');
  212. gradient.classList.add('hidden');
  213. })();
  214. </script>
  215. </body>
  216. </html>