khoj 1.28.4.dev23__py3-none-any.whl → 1.28.4.dev71__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 (65) hide show
  1. khoj/database/adapters/__init__.py +4 -0
  2. khoj/database/models/__init__.py +4 -0
  3. khoj/interface/compiled/404/index.html +1 -1
  4. khoj/interface/compiled/_next/static/chunks/1603-2418b11d8e8dacb9.js +1 -0
  5. khoj/interface/compiled/_next/static/chunks/3124-a4cea2eda163128d.js +1 -0
  6. khoj/interface/compiled/_next/static/chunks/5538-5c4f2271e9377b74.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/8423-a87e3671c4217ab6.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/9417-7a8a6da918d37750.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/app/agents/{page-36da67f03a173e52.js → page-ee4f0da14df15091.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/app/automations/{page-774ae3e033f938cd.js → page-da59a2b9ec07da16.js} +1 -1
  11. khoj/interface/compiled/_next/static/chunks/app/chat/page-04313ed6d8f38904.js +1 -0
  12. khoj/interface/compiled/_next/static/chunks/app/{page-322c37514a3a613a.js → page-5c06dadacb1b5945.js} +1 -1
  13. khoj/interface/compiled/_next/static/chunks/app/search/{page-9b64f61caa5bd7f9.js → page-4f44549ba3807021.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/app/settings/page-88dbd5c184dcd1e3.js +1 -0
  15. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-9257e8817dcd6af3.js +1 -0
  16. khoj/interface/compiled/_next/static/css/{9d45de78fba367c1.css → 2ff098d0815fdbc1.css} +1 -1
  17. khoj/interface/compiled/_next/static/css/af0f36f71f368260.css +25 -0
  18. khoj/interface/compiled/agents/index.html +1 -1
  19. khoj/interface/compiled/agents/index.txt +2 -2
  20. khoj/interface/compiled/automations/index.html +1 -1
  21. khoj/interface/compiled/automations/index.txt +2 -2
  22. khoj/interface/compiled/chat/index.html +1 -1
  23. khoj/interface/compiled/chat/index.txt +2 -2
  24. khoj/interface/compiled/index.html +1 -1
  25. khoj/interface/compiled/index.txt +2 -2
  26. khoj/interface/compiled/search/index.html +1 -1
  27. khoj/interface/compiled/search/index.txt +2 -2
  28. khoj/interface/compiled/settings/index.html +1 -1
  29. khoj/interface/compiled/settings/index.txt +2 -2
  30. khoj/interface/compiled/share/chat/index.html +1 -1
  31. khoj/interface/compiled/share/chat/index.txt +2 -2
  32. khoj/processor/content/docx/docx_to_entries.py +25 -19
  33. khoj/processor/content/pdf/pdf_to_entries.py +34 -26
  34. khoj/processor/conversation/anthropic/anthropic_chat.py +7 -1
  35. khoj/processor/conversation/google/gemini_chat.py +15 -2
  36. khoj/processor/conversation/offline/chat_model.py +4 -0
  37. khoj/processor/conversation/openai/gpt.py +6 -1
  38. khoj/processor/conversation/prompts.py +15 -4
  39. khoj/processor/conversation/utils.py +69 -11
  40. khoj/processor/image/generate.py +2 -0
  41. khoj/processor/tools/online_search.py +19 -3
  42. khoj/processor/tools/run_code.py +4 -0
  43. khoj/routers/api.py +5 -0
  44. khoj/routers/api_chat.py +66 -13
  45. khoj/routers/api_content.py +78 -6
  46. khoj/routers/helpers.py +98 -31
  47. khoj/routers/research.py +9 -2
  48. khoj/utils/rawconfig.py +32 -0
  49. {khoj-1.28.4.dev23.dist-info → khoj-1.28.4.dev71.dist-info}/METADATA +1 -1
  50. {khoj-1.28.4.dev23.dist-info → khoj-1.28.4.dev71.dist-info}/RECORD +56 -56
  51. khoj/interface/compiled/_next/static/chunks/1603-c1568f45947e9f2c.js +0 -1
  52. khoj/interface/compiled/_next/static/chunks/5538-bf582517a8dd3faa.js +0 -1
  53. khoj/interface/compiled/_next/static/chunks/8423-a1f432e4a8d9a6b0.js +0 -1
  54. khoj/interface/compiled/_next/static/chunks/8840-b8d7b9f0923c6651.js +0 -1
  55. khoj/interface/compiled/_next/static/chunks/9417-0d0fc7eb49a86abb.js +0 -1
  56. khoj/interface/compiled/_next/static/chunks/app/chat/page-a369e2bda9897794.js +0 -1
  57. khoj/interface/compiled/_next/static/chunks/app/settings/page-10b288c103f19468.js +0 -1
  58. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-959d5f097cf38c93.js +0 -1
  59. khoj/interface/compiled/_next/static/css/d2bc549245313f26.css +0 -25
  60. /khoj/interface/compiled/_next/static/{s_mKS5kELaw2v4a7_yWNP → I1jjXZh1lBQiY837mKXbn}/_buildManifest.js +0 -0
  61. /khoj/interface/compiled/_next/static/{s_mKS5kELaw2v4a7_yWNP → I1jjXZh1lBQiY837mKXbn}/_ssgManifest.js +0 -0
  62. /khoj/interface/compiled/_next/static/chunks/{1970-d44050bf658ae5cc.js → 1970-30985763f1451fa2.js} +0 -0
  63. {khoj-1.28.4.dev23.dist-info → khoj-1.28.4.dev71.dist-info}/WHEEL +0 -0
  64. {khoj-1.28.4.dev23.dist-info → khoj-1.28.4.dev71.dist-info}/entry_points.txt +0 -0
  65. {khoj-1.28.4.dev23.dist-info → khoj-1.28.4.dev71.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,5506))},5506:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(57437),o=s(11930),n=s.n(o),i=s(2265),r=s(48861),l=s(55538),c=s(58485);s(7395);var d=s(69591),h=s(79306),u=s(38423),g=s(9557);function m(e){let[t,s]=(0,i.useState)(""),[o,r]=(0,i.useState)([]),[c,d]=(0,i.useState)(!1),[h,g]=(0,i.useState)(null),m=(0,i.useRef)(null),p=e.setQueryToProcess,f=e.streamedMessages,x=e.isMobileWidth?"w-full":"w-4/6";return((0,i.useEffect)(()=>{if(o.length>0){let t=o.map(e=>encodeURIComponent(e));e.setImages(t)}},[o,e.setImages]),(0,i.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);r(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(d(!0),p(s))},[p,e.setImages]),(0,i.useEffect)(()=>{t&&(d(!0),p(t))},[t,p]),(0,i.useEffect)(()=>{f&&f.length>0&&f[f.length-1].completed?d(!1):s("")},[f]),e.publicConversationSlug||e.conversationId)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(l.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:g,setTitle:e.setTitle,pendingMessage:c?t:"",incomingMessages:e.streamedMessages,customClassName:x})}),(0,a.jsx)("div",{className:"".concat(n().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-t-2xl rounded-b-none md:rounded-xl h-fit ").concat(x," mr-auto ml-auto"),children:(0,a.jsx)(u.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>r(t=>[...t,e]),sendDisabled:c,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==h?void 0:h.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:m})})]}):(0,a.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}function p(){let[e,t]=(0,i.useState)(null),[s,o]=(0,i.useState)(!0),[l,u]=(0,i.useState)("Khoj AI - Chat"),[p,f]=(0,i.useState)(void 0),[x,_]=(0,i.useState)([]),[v,y]=(0,i.useState)(""),[C,S]=(0,i.useState)(!1),[b,I]=(0,i.useState)([]),[j,w]=(0,i.useState)(void 0),[B,N]=(0,i.useState)([]),O=(0,d.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},k=(0,h.GW)(),T=(0,d.IC)();async function E(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="";for(;;){let e;let{done:n,value:i}=await t.read();if(n){y(""),S(!1),N([]);break}for(o+=s.decode(i,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=x.find(e=>!e.completed);if(!e){console.error("No current message found");return}(0,g.VK)(t,e),_([...x])}}}}async function D(){if(!v||!p)return;let e={q:v,conversation_id:p,stream:!0,...O&&{region:O.region,country:O.country,city:O.city,country_code:O.countryCode,timezone:O.timezone},...B.length>0&&{image:B}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});try{await E(t)}catch(e){console.error(e)}}return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{o(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,d.EK)(),w(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{if(v&&!p){fetch("/api/chat/share/fork?public_conversation_slug=".concat(j),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{f(e.conversation_id)}).catch(e=>{console.error(e)});return}if(v){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:v||"",images:B};_(t=>[...t,e]),S(!0)}},[v,p,j]),(0,i.useEffect)(()=>{C&&D()},[C]),s)?(0,a.jsx)(c.Z,{}):j?(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:l}),(0,a.jsx)("div",{className:n().sidePanel,children:(0,a.jsx)(r.ZP,{conversationId:null!=p?p:null,uploadedFiles:b,isMobileWidth:T})}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsxs)("div",{className:n().chatBoxBody,children:[!T&&l&&(0,a.jsx)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:l&&(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:l})}),(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(c.Z,{}),children:(0,a.jsx)(m,{conversationId:p,streamedMessages:x,setQueryToProcess:y,isLoggedIn:null!==k,publicConversationSlug:j,chatOptionsData:e,setTitle:u,setUploadedFiles:I,isMobileWidth:T,setImages:N})})]})})]}):(0,a.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}},11930:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4"}}},function(e){e.O(0,[7849,9848,4836,3954,9001,3062,8840,3803,2261,9434,1603,9417,8423,5538,2971,7023,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);