index.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <!DOCTYPE html>
  2. <html lang="en" data-framework="javascript">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0">
  7. <meta name="description" content="A conversational AI system that listens, learns, and challenges">
  8. <meta property="og:title" content="ChatGPT">
  9. <meta property="og:image" content="https://openai.com/content/images/2022/11/ChatGPT.jpg">
  10. <meta property="og:description" content="A conversational AI system that listens, learns, and challenges">
  11. <meta property="og:url" content="https://g4f.ai">
  12. <link rel="stylesheet" href="/static/css/style.css">
  13. <link rel="stylesheet" href="/static/css/all.min.css">
  14. <link rel="apple-touch-icon" sizes="180x180" href="/static/img/apple-touch-icon.png">
  15. <link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon-32x32.png">
  16. <link rel="icon" type="image/png" sizes="16x16" href="/static/img/favicon-16x16.png">
  17. <link rel="manifest" href="/static/img/site.webmanifest">
  18. <script src="/static/js/highlightjs-copy.min.js"></script>
  19. <script src="/static/js/chat.v1.js" defer></script>
  20. <script src="https://cdn.jsdelivr.net/npm/markdown-it@13.0.1/dist/markdown-it.min.js"></script>
  21. <link rel="stylesheet" href="/static/css/dracula.min.css">
  22. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe/dist/photoswipe.css">
  23. <script>
  24. MathJax = {
  25. chtml: {
  26. scale: 1,
  27. displayAlign: 'left'
  28. }
  29. };
  30. </script>
  31. <script id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
  32. <script type="module" src="https://cdn.jsdelivr.net/npm/mistral-tokenizer-js" async>
  33. import mistralTokenizer from "mistral-tokenizer-js"
  34. </script>
  35. <script type="module" src="https://cdn.jsdelivr.net/gh/belladoreai/llama-tokenizer-js@master/llama-tokenizer.js" async>
  36. import llamaTokenizer from "llama-tokenizer-js"
  37. </script>
  38. <script src="https://cdn.jsdelivr.net/npm/gpt-tokenizer/dist/cl100k_base.js" async></script>
  39. <script src="https://cdn.jsdelivr.net/npm/gpt-tokenizer/dist/o200k_base.js" async></script>
  40. <script type="module" async>
  41. import PhotoSwipeLightbox from 'https://cdn.jsdelivr.net/npm/photoswipe/dist/photoswipe-lightbox.esm.js';
  42. const lightbox = new PhotoSwipeLightbox({
  43. gallery: '#messages',
  44. children: 'a:has(img)',
  45. secondaryZoomLevel: 2,
  46. pswpModule: () => import('https://cdn.jsdelivr.net/npm/photoswipe'),
  47. });
  48. lightbox.addFilter('itemData', (itemData, index) => {
  49. const img = itemData.element.querySelector('img');
  50. itemData.width = img.naturalWidth;
  51. itemData.height = img.naturalHeight;
  52. return itemData;
  53. });
  54. lightbox.on('uiRegister', function() {
  55. lightbox.pswp.ui.registerElement({
  56. name: 'custom-caption',
  57. order: 9,
  58. isButton: false,
  59. appendTo: 'root',
  60. html: 'Caption text',
  61. onInit: (el, pswp) => {
  62. lightbox.pswp.on('change', () => {
  63. const currSlideElement = lightbox.pswp.currSlide.data.element;
  64. if (currSlideElement) {
  65. el.innerText = currSlideElement.querySelector('img').getAttribute('alt');
  66. }
  67. });
  68. }
  69. });
  70. });
  71. lightbox.init();
  72. </script>
  73. <script>
  74. const user_image = '<img src="/static/img/user.png" alt="your avatar">';
  75. const gpt_image = '<img src="/static/img/gpt.png" alt="your avatar">';
  76. </script>
  77. <script src="/static/js/highlight.min.js"></script>
  78. <script>window.conversation_id = "{{chat_id}}"</script>
  79. <title>g4f - gui</title>
  80. </head>
  81. <body>
  82. <div class="gradient"></div>
  83. <div class="row">
  84. <div class="box conversations">
  85. <div class="top">
  86. <button class="new_convo" onclick="new_conversation()">
  87. <i class="fa-regular fa-plus"></i>
  88. <span>New Conversation</span>
  89. </button>
  90. </div>
  91. <div class="bottom_buttons">
  92. <button onclick="open_settings();">
  93. <i class="fa-solid fa-toolbox"></i>
  94. <span>Open Settings</span>
  95. </button>
  96. <div class="info">
  97. <i class="fa-brands fa-discord"></i>
  98. <span class="convo-title">discord ~ <a href="https://discord.gg/qXA4Wf4Fsm" target="_blank">discord.gg/qXA4Wf4Fsm</a>
  99. </span>
  100. </div>
  101. <div class="info">
  102. <i class="fa-brands fa-github"></i>
  103. <span class="convo-title">github ~ <a href="https://github.com/xtekky/gpt4free" target="_blank">@xtekky/gpt4free</a>
  104. </span>
  105. </div>
  106. <div class="info">
  107. <i class="fa-solid fa-star"></i>
  108. <span id="version_text" class="convo-title"></span>
  109. </div>
  110. </div>
  111. </div>
  112. <div class="settings hidden">
  113. <div class="paper">
  114. <h3>Settings</h3>
  115. <div class="field">
  116. <span class="label">Enable Dark Mode</span>
  117. <input type="checkbox" id="darkMode" checked />
  118. <label for="darkMode" class="toogle" title=""></label>
  119. </div>
  120. <div class="field">
  121. <span class="label">Web Access with DuckDuckGo</span>
  122. <input type="checkbox" id="switch" />
  123. <label for="switch" class="toogle" title="Add the pages of the first 5 search results to the query."></label>
  124. </div>
  125. <div class="field">
  126. <span class="label">Disable Conversation History</span>
  127. <input type="checkbox" id="history" />
  128. <label for="history" class="toogle" title="To improve the reaction time or if you have trouble with large conversations."></label>
  129. </div>
  130. <div class="field">
  131. <span class="label">Hide System-prompt</span>
  132. <input type="checkbox" id="hide-systemPrompt" />
  133. <label for="hide-systemPrompt" class="toogle" title="For more space on phones"></label>
  134. </div>
  135. <div class="field">
  136. <span class="label">Download generated images</span>
  137. <input type="checkbox" id="download_images" checked/>
  138. <label for="download_images" class="toogle" title="Download and save generated images to /generated_images"></label>
  139. </div>
  140. <div class="field">
  141. <span class="label">Refine files with spaCy</span>
  142. <input type="checkbox" id="refine"/>
  143. <label for="refine" class="toogle" title=""></label>
  144. </div>
  145. <div class="field box">
  146. <label for="systemPrompt" class="label" title="">System prompt</label>
  147. <textarea id="systemPrompt" placeholder="You are a helpful assistant."></textarea>
  148. </div>
  149. <div class="field box">
  150. <label for="message-input-height" class="label" title="">Input max. height</label>
  151. <input type="number" id="message-input-height" value="200"/>
  152. </div>
  153. <div class="field box">
  154. <label for="recognition-language" class="label" title="">Speech recognition language</label>
  155. <input type="text" id="recognition-language" value="" placeholder="navigator.language"/>
  156. <script>
  157. document.getElementById('recognition-language').placeholder = navigator.language;
  158. </script>
  159. </div>
  160. <div class="field box">
  161. <label for="Custom-api_base" class="label" title="">Custom Provider (Base Url):</label>
  162. <input type="text" id="Custom-api_base" name="Custom[api_base]" placeholder="http://localhost:8080/v1"/>
  163. </div>
  164. <div class="field box hidden">
  165. <label for="Custom-api_key" class="label" title="">Custom Provider:</label>
  166. <input type="text" id="Custom-api_key" name="Custom[api_key]" placeholder="api_key"/>
  167. </div>
  168. <div class="field box hidden">
  169. <label for="BingCreateImages-api_key" class="label" title="">Microsoft Designer in Bing:</label>
  170. <input type="text" id="BingCreateImages-api_key" name="BingCreateImages[api_key]" placeholder="&quot;_U&quot; cookie"/>
  171. </div>
  172. </div>
  173. <div class="bottom_buttons">
  174. <button onclick="delete_conversations()">
  175. <i class="fa-solid fa-trash"></i>
  176. <span>Clear Conversations</span>
  177. </button>
  178. <button onclick="save_storage()">
  179. <i class="fa-solid fa-download"></i>
  180. <a href="" onclick="return false;">Export Conversations</a>
  181. </button>
  182. <button id="showLog">
  183. <i class="fa-solid fa-terminal"></i>
  184. <a href="" onclick="return false;">Show log</a>
  185. </button>
  186. </div>
  187. </div>
  188. <div class="provider_forms hidden">
  189. <div class="bottom_buttons">
  190. <button id="close_provider_forms">
  191. <i class="fa-regular fa-circle-xmark"></i>
  192. <a href="" onclick="return false;">Close</a>
  193. </button>
  194. </div>
  195. </div>
  196. <div class="conversation">
  197. <textarea id="chatPrompt" class="box" placeholder="System prompt"></textarea>
  198. <div id="messages" class="box"></div>
  199. <button class="slide-systemPrompt">
  200. <i class="fa-solid fa-angles-up"></i>
  201. </button>
  202. <div class="media_player">
  203. <i class="fa-regular fa-x"></i>
  204. </div>
  205. <div class="toolbar">
  206. <div id="input-count" class="">
  207. <button class="hide-input">
  208. <i class="fa-solid fa-angles-down"></i>
  209. </button>
  210. <input type="checkbox" id="agree" name="agree" value="yes" checked>
  211. <label for="agree" class="text" onclick="this.innerText='';">Scroll to bottom</label>
  212. </div>
  213. <div class="stop_generating stop_generating-hidden">
  214. <button id="cancelButton">
  215. <span>Stop Generating</span>
  216. <i class="fa-solid fa-stop"></i>
  217. </button>
  218. </div>
  219. <div class="regenerate">
  220. <button id="regenerateButton">
  221. <span>Regenerate</span>
  222. <i class="fa-solid fa-rotate"></i>
  223. </button>
  224. </div>
  225. </div>
  226. <div class="user-input">
  227. <div class="box input-box">
  228. <textarea id="message-input" placeholder="Ask a question" cols="30" rows="10"
  229. style="white-space: pre-wrap;resize: none;"></textarea>
  230. <label class="file-label image-label" for="image" title="">
  231. <input type="file" id="image" name="image" accept="image/*" required multiple/>
  232. <i class="fa-regular fa-image"></i>
  233. </label>
  234. <label class="file-label image-label" for="camera">
  235. <input type="file" id="camera" name="camera" accept="image/*" capture="camera" required/>
  236. <i class="fa-solid fa-camera"></i>
  237. </label>
  238. <label class="file-label" for="file">
  239. <input type="file" id="file" name="file" accept=".txt, .html, .xml, .json, .js, .har, .sh, .py, .php, .css, .yaml, .sql, .log, .csv, .twig, .md, .pdf, .docx, .odt, .epub, .xlsx, .zip" required multiple/>
  240. <i class="fa-solid fa-paperclip"></i>
  241. </label>
  242. <label class="micro-label" for="micro">
  243. <i class="fa-solid fa-microphone-slash"></i>
  244. </label>
  245. <div id="send-button">
  246. <i class="fa-regular fa-paper-plane"></i>
  247. </div>
  248. </div>
  249. </div>
  250. <div class="buttons">
  251. <div class="field">
  252. <button id="search">
  253. <a href="" onclick="return false;" title="Enable Web Access">
  254. <i class="fa-solid fa-search"></i>
  255. </a>
  256. </button>
  257. </div>
  258. <div class="field">
  259. <select name="model" id="model">
  260. <option value="">Model: Default</option>
  261. <option value="gpt-4">gpt-4</option>
  262. <option value="gpt-4o">gpt-4o</option>
  263. <option value="gpt-4o-mini">gpt-4o-mini</option>
  264. <option value="llama-3.1-70b">llama-3.1-70b</option>
  265. <option value="mixtral-8x7b">mixtral-8x7b</option>
  266. <option value="claude-3.5-sonnet">claude-3.5-sonnet</option>
  267. <option value="flux">flux (Image Generation)</option>
  268. <option value="dall-e-3">dall-e-3 (Image Generation)</option>
  269. <option disabled="disabled">----</option>
  270. </select>
  271. <select name="model2" id="model2" class="hidden"></select>
  272. </div>
  273. <div class="field">
  274. <select name="provider" id="provider">
  275. <option value="">Provider: Auto</option>
  276. <option value="OpenaiChat">OpenAI ChatGPT</option>
  277. <option value="Copilot">Microsoft Copilot</option>
  278. <option value="Gemini">Google Gemini</option>
  279. <option value="DDG">DuckDuckGo AI Chat</option>
  280. <option value="Blackbox">Blackbox AI</option>
  281. <option disabled="disabled">----</option>
  282. </select>
  283. </div>
  284. <div class="field">
  285. <button id="pin">
  286. <i class="fa-solid fa-thumbtack"></i>
  287. </button>
  288. </div>
  289. <div id="pin_container" class="field"></div>
  290. </div>
  291. </div>
  292. <div class="log hidden"></div>
  293. </div>
  294. <div class="mobile-sidebar">
  295. <i class="fa-solid fa-bars"></i>
  296. </div>
  297. </body>
  298. </html>