khoj 1.17.1.dev229__py3-none-any.whl → 1.20.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. khoj/app/settings.py +7 -2
  2. khoj/configure.py +21 -0
  3. khoj/database/adapters/__init__.py +9 -5
  4. khoj/database/admin.py +2 -0
  5. khoj/database/migrations/0055_alter_agent_style_icon.py +37 -0
  6. khoj/database/models/__init__.py +2 -0
  7. khoj/interface/compiled/404/index.html +1 -0
  8. khoj/interface/compiled/_next/static/chunks/1603-fb2d80ae73990df3.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/2614-7cf01576d4457a75.js +3 -0
  10. khoj/interface/compiled/_next/static/chunks/3062-a42d847c919a9ea4.js +29 -0
  11. khoj/interface/compiled/_next/static/chunks/3678-8c0e55c3b5d83a22.js +25 -0
  12. khoj/interface/compiled/_next/static/chunks/4504-1629487c8bc82203.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/6297-d1c842ed3f714ab0.js +1 -0
  14. khoj/interface/compiled/_next/static/chunks/6648-ff677e51f1b2bcf1.js +1 -0
  15. khoj/interface/compiled/_next/static/chunks/7023-52c1be60135eb057.js +2 -0
  16. khoj/interface/compiled/_next/static/chunks/7071-b4711cecca6619a8.js +1 -0
  17. khoj/interface/compiled/_next/static/chunks/743-1a64254447cda71f.js +1 -0
  18. khoj/interface/compiled/_next/static/chunks/8423-132ea64eac83fd43.js +1 -0
  19. khoj/interface/compiled/_next/static/chunks/9001-acbca3e19b1a5ddf.js +21 -0
  20. khoj/interface/compiled/_next/static/chunks/9162-4a6d0d0dc5e27618.js +11 -0
  21. khoj/interface/compiled/_next/static/chunks/9178-859894e0d9d67aa5.js +1 -0
  22. khoj/interface/compiled/_next/static/chunks/9417-2e54c6fd056982d8.js +1 -0
  23. khoj/interface/compiled/_next/static/chunks/9693-91b03052c5cabded.js +1 -0
  24. khoj/interface/compiled/_next/static/chunks/app/_not-found/page-07ff4ab42b07845e.js +1 -0
  25. khoj/interface/compiled/_next/static/chunks/app/agents/layout-e71c8e913cccf792.js +1 -0
  26. khoj/interface/compiled/_next/static/chunks/app/agents/page-922694b75f1fb67b.js +1 -0
  27. khoj/interface/compiled/_next/static/chunks/app/automations/layout-27c28e923c9b1ff0.js +1 -0
  28. khoj/interface/compiled/_next/static/chunks/app/automations/page-46913728bcb8f4c6.js +1 -0
  29. khoj/interface/compiled/_next/static/chunks/app/chat/layout-8102549127db3067.js +1 -0
  30. khoj/interface/compiled/_next/static/chunks/app/chat/page-51ab7c4b766ff344.js +1 -0
  31. khoj/interface/compiled/_next/static/chunks/app/factchecker/layout-7b30c541c05fb904.js +1 -0
  32. khoj/interface/compiled/_next/static/chunks/app/factchecker/page-60be5e3295e2c0bc.js +1 -0
  33. khoj/interface/compiled/_next/static/chunks/app/layout-f3e40d346da53112.js +1 -0
  34. khoj/interface/compiled/_next/static/chunks/app/page-635b30b582201b05.js +1 -0
  35. khoj/interface/compiled/_next/static/chunks/app/search/layout-3720f1362310bebb.js +1 -0
  36. khoj/interface/compiled/_next/static/chunks/app/search/page-dcd385f03255ef36.js +1 -0
  37. khoj/interface/compiled/_next/static/chunks/app/settings/layout-6f9314b0d7a26046.js +1 -0
  38. khoj/interface/compiled/_next/static/chunks/app/settings/page-e83f6fa32691ca64.js +1 -0
  39. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-39f03f9e32399f0f.js +1 -0
  40. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-699b364dc6fbf139.js +1 -0
  41. khoj/interface/compiled/_next/static/chunks/d3ac728e-a9e3522eef9b6b28.js +1 -0
  42. khoj/interface/compiled/_next/static/chunks/fd9d1056-2b978342deb60015.js +1 -0
  43. khoj/interface/compiled/_next/static/chunks/framework-8e0e0f4a6b83a956.js +33 -0
  44. khoj/interface/compiled/_next/static/chunks/main-175c164f5e0f026c.js +1 -0
  45. khoj/interface/compiled/_next/static/chunks/main-app-6d6ee3495efe03d4.js +1 -0
  46. khoj/interface/compiled/_next/static/chunks/pages/_app-f870474a17b7f2fd.js +1 -0
  47. khoj/interface/compiled/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js +1 -0
  48. khoj/interface/compiled/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js +1 -0
  49. khoj/interface/compiled/_next/static/chunks/webpack-97d9516936918753.js +1 -0
  50. khoj/interface/compiled/_next/static/css/1538cedb321e3a97.css +1 -0
  51. khoj/interface/compiled/_next/static/css/1de368beed21dfba.css +25 -0
  52. khoj/interface/compiled/_next/static/css/2272c73fc7a3b571.css +1 -0
  53. khoj/interface/compiled/_next/static/css/4cae6c0e5c72fb2d.css +1 -0
  54. khoj/interface/compiled/_next/static/css/553f9cdcc7a2bcd6.css +1 -0
  55. khoj/interface/compiled/_next/static/css/a22d83f18a32957e.css +1 -0
  56. khoj/interface/compiled/_next/static/css/a3530ec58b0b660f.css +1 -0
  57. khoj/interface/compiled/_next/static/css/b81e909d403fb2df.css +1 -0
  58. khoj/interface/compiled/_next/static/css/df6f4c34ec280d53.css +1 -0
  59. khoj/interface/compiled/_next/static/iCI2Ycgat9pFGG9HeJvvH/_buildManifest.js +1 -0
  60. khoj/interface/compiled/_next/static/iCI2Ycgat9pFGG9HeJvvH/_ssgManifest.js +1 -0
  61. khoj/interface/compiled/_next/static/media/0e790e04fd40ad16-s.p.woff2 +0 -0
  62. khoj/interface/compiled/_next/static/media/4221e1667cd19c7d-s.woff2 +0 -0
  63. khoj/interface/compiled/_next/static/media/6c276159aa0eb14b-s.woff2 +0 -0
  64. khoj/interface/compiled/_next/static/media/6cc0b9500e4f9168-s.woff2 +0 -0
  65. khoj/interface/compiled/_next/static/media/9d9319a7a2ac39c6-s.woff2 +0 -0
  66. khoj/interface/compiled/_next/static/media/KaTeX_AMS-Regular.1608a09b.woff +0 -0
  67. khoj/interface/compiled/_next/static/media/KaTeX_AMS-Regular.4aafdb68.ttf +0 -0
  68. khoj/interface/compiled/_next/static/media/KaTeX_AMS-Regular.a79f1c31.woff2 +0 -0
  69. khoj/interface/compiled/_next/static/media/KaTeX_Caligraphic-Bold.b6770918.woff +0 -0
  70. khoj/interface/compiled/_next/static/media/KaTeX_Caligraphic-Bold.cce5b8ec.ttf +0 -0
  71. khoj/interface/compiled/_next/static/media/KaTeX_Caligraphic-Bold.ec17d132.woff2 +0 -0
  72. khoj/interface/compiled/_next/static/media/KaTeX_Caligraphic-Regular.07ef19e7.ttf +0 -0
  73. khoj/interface/compiled/_next/static/media/KaTeX_Caligraphic-Regular.55fac258.woff2 +0 -0
  74. khoj/interface/compiled/_next/static/media/KaTeX_Caligraphic-Regular.dad44a7f.woff +0 -0
  75. khoj/interface/compiled/_next/static/media/KaTeX_Fraktur-Bold.9f256b85.woff +0 -0
  76. khoj/interface/compiled/_next/static/media/KaTeX_Fraktur-Bold.b18f59e1.ttf +0 -0
  77. khoj/interface/compiled/_next/static/media/KaTeX_Fraktur-Bold.d42a5579.woff2 +0 -0
  78. khoj/interface/compiled/_next/static/media/KaTeX_Fraktur-Regular.7c187121.woff +0 -0
  79. khoj/interface/compiled/_next/static/media/KaTeX_Fraktur-Regular.d3c882a6.woff2 +0 -0
  80. khoj/interface/compiled/_next/static/media/KaTeX_Fraktur-Regular.ed38e79f.ttf +0 -0
  81. khoj/interface/compiled/_next/static/media/KaTeX_Main-Bold.b74a1a8b.ttf +0 -0
  82. khoj/interface/compiled/_next/static/media/KaTeX_Main-Bold.c3fb5ac2.woff2 +0 -0
  83. khoj/interface/compiled/_next/static/media/KaTeX_Main-Bold.d181c465.woff +0 -0
  84. khoj/interface/compiled/_next/static/media/KaTeX_Main-BoldItalic.6f2bb1df.woff2 +0 -0
  85. khoj/interface/compiled/_next/static/media/KaTeX_Main-BoldItalic.70d8b0a5.ttf +0 -0
  86. khoj/interface/compiled/_next/static/media/KaTeX_Main-BoldItalic.e3f82f9d.woff +0 -0
  87. khoj/interface/compiled/_next/static/media/KaTeX_Main-Italic.47373d1e.ttf +0 -0
  88. khoj/interface/compiled/_next/static/media/KaTeX_Main-Italic.8916142b.woff2 +0 -0
  89. khoj/interface/compiled/_next/static/media/KaTeX_Main-Italic.9024d815.woff +0 -0
  90. khoj/interface/compiled/_next/static/media/KaTeX_Main-Regular.0462f03b.woff2 +0 -0
  91. khoj/interface/compiled/_next/static/media/KaTeX_Main-Regular.7f51fe03.woff +0 -0
  92. khoj/interface/compiled/_next/static/media/KaTeX_Main-Regular.b7f8fe9b.ttf +0 -0
  93. khoj/interface/compiled/_next/static/media/KaTeX_Math-BoldItalic.572d331f.woff2 +0 -0
  94. khoj/interface/compiled/_next/static/media/KaTeX_Math-BoldItalic.a879cf83.ttf +0 -0
  95. khoj/interface/compiled/_next/static/media/KaTeX_Math-BoldItalic.f1035d8d.woff +0 -0
  96. khoj/interface/compiled/_next/static/media/KaTeX_Math-Italic.5295ba48.woff +0 -0
  97. khoj/interface/compiled/_next/static/media/KaTeX_Math-Italic.939bc644.ttf +0 -0
  98. khoj/interface/compiled/_next/static/media/KaTeX_Math-Italic.f28c23ac.woff2 +0 -0
  99. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Bold.8c5b5494.woff2 +0 -0
  100. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Bold.94e1e8dc.ttf +0 -0
  101. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Bold.bf59d231.woff +0 -0
  102. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Italic.3b1e59b3.woff2 +0 -0
  103. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Italic.7c9bc82b.woff +0 -0
  104. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Italic.b4c20c84.ttf +0 -0
  105. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Regular.74048478.woff +0 -0
  106. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Regular.ba21ed5f.woff2 +0 -0
  107. khoj/interface/compiled/_next/static/media/KaTeX_SansSerif-Regular.d4d7ba48.ttf +0 -0
  108. khoj/interface/compiled/_next/static/media/KaTeX_Script-Regular.03e9641d.woff2 +0 -0
  109. khoj/interface/compiled/_next/static/media/KaTeX_Script-Regular.07505710.woff +0 -0
  110. khoj/interface/compiled/_next/static/media/KaTeX_Script-Regular.fe9cbbe1.ttf +0 -0
  111. khoj/interface/compiled/_next/static/media/KaTeX_Size1-Regular.e1e279cb.woff +0 -0
  112. khoj/interface/compiled/_next/static/media/KaTeX_Size1-Regular.eae34984.woff2 +0 -0
  113. khoj/interface/compiled/_next/static/media/KaTeX_Size1-Regular.fabc004a.ttf +0 -0
  114. khoj/interface/compiled/_next/static/media/KaTeX_Size2-Regular.57727022.woff +0 -0
  115. khoj/interface/compiled/_next/static/media/KaTeX_Size2-Regular.5916a24f.woff2 +0 -0
  116. khoj/interface/compiled/_next/static/media/KaTeX_Size2-Regular.d6b476ec.ttf +0 -0
  117. khoj/interface/compiled/_next/static/media/KaTeX_Size3-Regular.9acaf01c.woff +0 -0
  118. khoj/interface/compiled/_next/static/media/KaTeX_Size3-Regular.a144ef58.ttf +0 -0
  119. khoj/interface/compiled/_next/static/media/KaTeX_Size3-Regular.b4230e7e.woff2 +0 -0
  120. khoj/interface/compiled/_next/static/media/KaTeX_Size4-Regular.10d95fd3.woff2 +0 -0
  121. khoj/interface/compiled/_next/static/media/KaTeX_Size4-Regular.7a996c9d.woff +0 -0
  122. khoj/interface/compiled/_next/static/media/KaTeX_Size4-Regular.fbccdabe.ttf +0 -0
  123. khoj/interface/compiled/_next/static/media/KaTeX_Typewriter-Regular.6258592b.woff +0 -0
  124. khoj/interface/compiled/_next/static/media/KaTeX_Typewriter-Regular.a8709e36.woff2 +0 -0
  125. khoj/interface/compiled/_next/static/media/KaTeX_Typewriter-Regular.d97aaf4a.ttf +0 -0
  126. khoj/interface/compiled/_next/static/media/a75c8ea86756d52d-s.woff2 +0 -0
  127. khoj/interface/compiled/_next/static/media/abce7c400ca31a51-s.woff2 +0 -0
  128. khoj/interface/compiled/_next/static/media/f759c939737fb668-s.woff2 +0 -0
  129. khoj/interface/compiled/_next/static/media/flags.3afdda2f.webp +0 -0
  130. khoj/interface/compiled/_next/static/media/flags@2x.5fbe9fc1.webp +0 -0
  131. khoj/interface/compiled/_next/static/media/globe.98e105ca.webp +0 -0
  132. khoj/interface/compiled/_next/static/media/globe@2x.974df6f8.webp +0 -0
  133. khoj/interface/compiled/agents/index.html +1 -0
  134. khoj/interface/compiled/agents/index.txt +7 -0
  135. khoj/interface/compiled/agents.svg +6 -0
  136. khoj/interface/compiled/automation.svg +37 -0
  137. khoj/interface/compiled/automations/index.html +1 -0
  138. khoj/interface/compiled/automations/index.txt +8 -0
  139. khoj/interface/compiled/chat/index.html +1 -0
  140. khoj/interface/compiled/chat/index.txt +7 -0
  141. khoj/interface/compiled/close.svg +5 -0
  142. khoj/interface/compiled/factchecker/index.html +1 -0
  143. khoj/interface/compiled/factchecker/index.txt +7 -0
  144. khoj/interface/compiled/favicon.ico +0 -0
  145. khoj/interface/compiled/index.html +1 -0
  146. khoj/interface/compiled/index.txt +7 -0
  147. khoj/interface/compiled/logo.svg +24 -0
  148. khoj/interface/compiled/search/index.html +1 -0
  149. khoj/interface/compiled/search/index.txt +7 -0
  150. khoj/interface/compiled/settings/index.html +1 -0
  151. khoj/interface/compiled/settings/index.txt +8 -0
  152. khoj/interface/compiled/share/chat/index.html +1 -0
  153. khoj/interface/compiled/share/chat/index.txt +7 -0
  154. khoj/interface/web/assets/icons/agents.svg +17 -5
  155. khoj/interface/web/assets/icons/automation.svg +40 -35
  156. khoj/interface/web/assets/icons/search.svg +40 -8
  157. khoj/interface/web/login.html +1 -1
  158. khoj/routers/api_chat.py +5 -16
  159. khoj/routers/helpers.py +74 -0
  160. khoj/routers/web_client.py +30 -131
  161. khoj/utils/constants.py +1 -0
  162. {khoj-1.17.1.dev229.dist-info → khoj-1.20.3.dist-info}/METADATA +1 -1
  163. khoj-1.20.3.dist-info/RECORD +353 -0
  164. khoj/interface/web/404.html +0 -56
  165. khoj/interface/web/agent.html +0 -312
  166. khoj/interface/web/agents.html +0 -276
  167. khoj/interface/web/assets/icons/cancel.svg +0 -3
  168. khoj/interface/web/assets/icons/collapse.svg +0 -17
  169. khoj/interface/web/assets/icons/computer.png +0 -0
  170. khoj/interface/web/assets/icons/confirm-icon.svg +0 -1
  171. khoj/interface/web/assets/icons/credit-card.png +0 -0
  172. khoj/interface/web/assets/icons/delete.svg +0 -26
  173. khoj/interface/web/assets/icons/docx.svg +0 -7
  174. khoj/interface/web/assets/icons/edit.svg +0 -4
  175. khoj/interface/web/assets/icons/key.svg +0 -4
  176. khoj/interface/web/assets/icons/markdown.svg +0 -1
  177. khoj/interface/web/assets/icons/new.svg +0 -23
  178. khoj/interface/web/assets/icons/notion.svg +0 -4
  179. khoj/interface/web/assets/icons/openai-logomark.svg +0 -1
  180. khoj/interface/web/assets/icons/org.svg +0 -1
  181. khoj/interface/web/assets/icons/pdf.svg +0 -23
  182. khoj/interface/web/assets/icons/pencil-edit.svg +0 -5
  183. khoj/interface/web/assets/icons/plaintext.svg +0 -1
  184. khoj/interface/web/assets/icons/question-mark-icon.svg +0 -1
  185. khoj/interface/web/assets/icons/speaker.svg +0 -4
  186. khoj/interface/web/assets/icons/stop-solid.svg +0 -37
  187. khoj/interface/web/assets/icons/user-silhouette.svg +0 -4
  188. khoj/interface/web/assets/icons/voice.svg +0 -8
  189. khoj/interface/web/assets/icons/web.svg +0 -2
  190. khoj/interface/web/assets/icons/whatsapp.svg +0 -17
  191. khoj/interface/web/assets/markdown-it.min.js +0 -8476
  192. khoj/interface/web/assets/natural-cron.min.js +0 -1
  193. khoj/interface/web/assets/org.min.js +0 -1823
  194. khoj/interface/web/assets/pico.min.css +0 -5
  195. khoj/interface/web/assets/purify.min.js +0 -3
  196. khoj/interface/web/chat.html +0 -3436
  197. khoj/interface/web/config_automation.html +0 -1103
  198. khoj/interface/web/content_source_computer_input.html +0 -139
  199. khoj/interface/web/content_source_notion_input.html +0 -94
  200. khoj/interface/web/public_conversation.html +0 -2006
  201. khoj/interface/web/search.html +0 -470
  202. khoj/interface/web/settings.html +0 -1011
  203. khoj-1.17.1.dev229.dist-info/RECORD +0 -244
  204. /khoj/interface/{web/assets/icons → compiled}/chat.svg +0 -0
  205. /khoj/interface/{web/assets/icons → compiled}/copy-button-success.svg +0 -0
  206. /khoj/interface/{web/assets/icons → compiled}/copy-button.svg +0 -0
  207. /khoj/interface/{web/assets/icons → compiled}/send.svg +0 -0
  208. /khoj/interface/{web/assets/icons → compiled}/share.svg +0 -0
  209. /khoj/interface/{web/assets/icons/thumbs-down-svgrepo-com.svg → compiled/thumbs-down.svg} +0 -0
  210. /khoj/interface/{web/assets/icons/thumbs-up-svgrepo-com.svg → compiled/thumbs-up.svg} +0 -0
  211. {khoj-1.17.1.dev229.dist-info → khoj-1.20.3.dist-info}/WHEEL +0 -0
  212. {khoj-1.17.1.dev229.dist-info → khoj-1.20.3.dist-info}/entry_points.txt +0 -0
  213. {khoj-1.17.1.dev229.dist-info → khoj-1.20.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,139 +0,0 @@
1
- {% extends "base_config.html" %}
2
- {% block content %}
3
- <div class="page">
4
- <div class="section">
5
- <h2 class="section-title">
6
- <img class="card-icon" src="/static/assets/icons/computer.png?v={{ khoj_version }}" alt="files">
7
- <span class="card-title-text">Files</span>
8
- <div class="instructions">
9
- <p class="card-description">Manage files from your computer</p>
10
- <p id="get-desktop-client" class="card-description">Get the Khoj <a href="https://khoj.dev/downloads">Desktop</a>, <a href="https://docs.khoj.dev/#/obsidian?id=setup">Obsidian</a> or <a href="https://docs.khoj.dev/#/emacs?id=setup">Emacs</a> app to sync documents from your computer</p>
11
- </div>
12
- </h2>
13
- <div class="section-manage-files">
14
- <div id="delete-all-files" class="delete-all-files">
15
- <button id="delete-all-files-button" type="submit" title="Remove all computer files from Khoj">🗑️ Delete all</button>
16
- </div>
17
- <div class="indexed-files">
18
- </div>
19
- </div>
20
- </div>
21
- </div>
22
- <style>
23
- #desktop-client {
24
- font-weight: normal;
25
- }
26
- .indexed-files {
27
- width: 100%;
28
- }
29
- .content-name {
30
- font-size: smaller;
31
- }
32
- </style>
33
- <script>
34
- function removeFile(path) {
35
- fetch('/api/content/file?filename=' + path, {
36
- method: 'DELETE',
37
- headers: {
38
- 'Content-Type': 'application/json',
39
- }
40
- })
41
- .then(response => response.ok ? response.json() : Promise.reject(response))
42
- .then(data => {
43
- if (data.status == "ok") {
44
- getAllComputerFilenames();
45
- }
46
- })
47
- }
48
-
49
- // Get all currently indexed files
50
- function getAllComputerFilenames() {
51
- fetch('/api/content/computer')
52
- .then(response => response.json())
53
- .then(data => {
54
- var indexedFiles = document.getElementsByClassName("indexed-files")[0];
55
- indexedFiles.innerHTML = "";
56
-
57
- if (data.length == 0) {
58
- document.getElementById("delete-all-files").style.display = "none";
59
- let noFilesElement = document.createElement("div");
60
- noFilesElement.classList.add("card-description");
61
- noFilesElement.textContent = "No documents synced with Khoj";
62
- indexedFiles.appendChild(noFilesElement);
63
- } else {
64
- document.getElementById("get-desktop-client").style.display = "none";
65
- document.getElementById("delete-all-files").style.display = "block";
66
- }
67
-
68
- for (var filename of data) {
69
- let fileElement = document.createElement("div");
70
- fileElement.classList.add("file-element");
71
-
72
- let fileExtension = filename.split('.').pop();
73
- if (fileExtension === "org")
74
- image_name = "org.svg"
75
- else if (fileExtension === "pdf")
76
- image_name = "pdf.svg"
77
- else if (fileExtension === "markdown" || fileExtension === "md")
78
- image_name = "markdown.svg"
79
- else if (fileExtension === "docx")
80
- image_name = "docx.svg"
81
- else
82
- image_name = "plaintext.svg"
83
-
84
- let fileIconElement = document.createElement("img");
85
- fileIconElement.classList.add("card-icon");
86
- fileIconElement.src = `/static/assets/icons/${image_name}`;
87
- fileIconElement.alt = "File";
88
- fileElement.appendChild(fileIconElement);
89
-
90
- let fileNameElement = document.createElement("div");
91
- fileNameElement.classList.add("content-name");
92
- fileNameElement.textContent = filename;
93
- fileElement.appendChild(fileNameElement);
94
-
95
- let buttonContainer = document.createElement("div");
96
- buttonContainer.classList.add("remove-button-container");
97
- let removeFileButton = document.createElement("button");
98
- removeFileButton.classList.add("remove-file-button");
99
- removeFileButton.textContent = "🗑️";
100
- removeFileButton.addEventListener("click", ((filename) => {
101
- return () => {
102
- removeFile(filename);
103
- };
104
- })(filename));
105
- buttonContainer.appendChild(removeFileButton);
106
- fileElement.appendChild(buttonContainer);
107
- indexedFiles.appendChild(fileElement);
108
- }
109
- })
110
- .catch((error) => {
111
- console.error('Error:', error);
112
- });
113
- }
114
-
115
- // Get all currently indexed files on page load
116
- getAllComputerFilenames();
117
-
118
- let deleteAllComputerFilesButton = document.getElementById("delete-all-files-button");
119
- deleteAllComputerFilesButton.addEventListener("click", function(event) {
120
- event.preventDefault();
121
- originalDeleteAllComputerFilesButtonText = deleteAllComputerFilesButton.textContent;
122
- deleteAllComputerFilesButton.textContent = "🗑️ Deleting...";
123
- deleteAllComputerFilesButton.disabled = true;
124
-
125
- fetch('/api/content/computer', {
126
- method: 'DELETE',
127
- headers: {
128
- 'Content-Type': 'application/json',
129
- }
130
- })
131
- .then(response => response.json())
132
- .finally(() => {
133
- getAllComputerFilenames();
134
- deleteAllComputerFilesButton.textContent = originalDeleteAllComputerFilesButtonText;
135
- deleteAllComputerFilesButton.disabled = false;
136
- });
137
- });
138
- </script>
139
- {% endblock %}
@@ -1,94 +0,0 @@
1
- {% extends "base_config.html" %}
2
- {% block content %}
3
- <div class="page">
4
- <div class="section">
5
- <h2 class="section-title">
6
- <img class="card-icon" src="/static/assets/icons/notion.svg?v={{ khoj_version }}" alt="Notion">
7
- <span class="card-title-text">Notion</span>
8
- <div class="instructions">
9
- <a href="https://docs.khoj.dev/data-sources/notion_integration">ⓘ Help</a>
10
- </div>
11
- <table>
12
- <tr>
13
- <td>
14
- <label for="token">Token</label>
15
- </td>
16
- <td>
17
- <input type="text" id="token" name="pat" value="{{ current_config['token'] }}">
18
- </td>
19
- </tr>
20
- </table>
21
- <div class="section">
22
- <div id="success" style="display: none;"></div>
23
- <button id="submit" type="submit">Sync to Update</button>
24
- </div>
25
- </form>
26
- </div>
27
- </div>
28
- <script>
29
- const submit = document.getElementById("submit");
30
-
31
- submit.addEventListener("click", function(event) {
32
- event.preventDefault();
33
-
34
- const token = document.getElementById("token").value;
35
-
36
- if (token == "") {
37
- document.getElementById("success").textContent = "❌ Please enter a Notion Token.";
38
- document.getElementById("success").style.display = "block";
39
- return;
40
- }
41
-
42
- const submitButton = document.getElementById("submit");
43
- submitButton.disabled = true;
44
- submitButton.textContent = "Syncing...";
45
-
46
- // Save Notion config on server
47
- const csrfToken = document.cookie.split('; ').find(row => row.startsWith('csrftoken'))?.split('=')[1];
48
- fetch('/api/content/notion', {
49
- method: 'POST',
50
- headers: {
51
- 'Content-Type': 'application/json',
52
- 'X-CSRFToken': csrfToken,
53
- },
54
- body: JSON.stringify({
55
- "token": token,
56
- })
57
- })
58
- .then(response => response.json())
59
- .then(data => { data["status"] === "ok" ? data : Promise.reject(data) })
60
- .catch(error => {
61
- document.getElementById("success").textContent = "⚠️ Failed to save Notion settings.";
62
- document.getElementById("success").style.display = "block";
63
- submitButton.textContent = "⚠️ Failed to save settings";
64
- setTimeout(function() {
65
- submitButton.textContent = "Save";
66
- submitButton.disabled = false;
67
- }, 2000);
68
- return;
69
- });
70
-
71
- // Index Notion content on server
72
- fetch('/api/update?t=notion')
73
- .then(response => response.json())
74
- .then(data => { data["status"] == "ok" ? data : Promise.reject(data) })
75
- .then(data => {
76
- document.getElementById("success").style.display = "none";
77
- submitButton.textContent = "✅ Successfully updated";
78
- setTimeout(function() {
79
- submitButton.textContent = "Save";
80
- submitButton.disabled = false;
81
- }, 2000);
82
- })
83
- .catch(error => {
84
- document.getElementById("success").textContent = "⚠️ Failed to save Notion content.";
85
- document.getElementById("success").style.display = "block";
86
- submitButton.textContent = "⚠️ Failed to save content";
87
- setTimeout(function() {
88
- submitButton.textContent = "Save";
89
- submitButton.disabled = false;
90
- }, 2000);
91
- });
92
- });
93
- </script>
94
- {% endblock %}