├── .gitattributes ├── .github └── dependabot.yml ├── .gitignore ├── .prettierignore ├── .vscode ├── launch.json └── toolkit.code-snippets ├── LICENSE ├── README.md ├── addon ├── bootstrap.js ├── chrome │ └── content │ │ ├── icons │ │ ├── favicon.png │ │ ├── favicon@0.333x.png │ │ ├── favicon@0.5x.png │ │ ├── favicon@16x16.png │ │ ├── favicon@4x.png │ │ ├── favicon@6x.png │ │ └── openai.png │ │ ├── libs │ │ ├── tiktoken_bg.wasm │ │ └── vector_search_bg.wasm │ │ ├── popup.xhtml │ │ ├── preferences.xhtml │ │ └── zoteroPane.css ├── locale │ ├── en-US │ │ ├── addon.ftl │ │ └── preferences.ftl │ └── zh-CN │ │ ├── addon.ftl │ │ └── preferences.ftl ├── manifest.json └── prefs.js ├── assets ├── icons │ └── upload.svg ├── images │ ├── aria.png │ ├── favicon.svg │ ├── preferences.png │ ├── social-github.png │ ├── social-github.xcf │ ├── social.png │ └── social.xcf ├── screenshots │ ├── 2023-04-12-03-54-39.png │ ├── 2023-04-12-03-55-52.png │ ├── 2023-04-12-04-03-44.png │ ├── 2023-04-12-04-06-14.png │ └── 2023-04-12-04-07-55.png └── videos │ ├── autocompletion.gif │ ├── drag-and-drop.gif │ ├── feedback.gif │ ├── gpt-4-vision.gif │ ├── note-annotation.gif │ └── prompt-library.gif ├── docs ├── configuration.md └── update.md ├── eslint.config.mjs ├── legacyScripts ├── build.mjs ├── scripts.mjs ├── server.mjs ├── start.mjs ├── stop.mjs ├── update-template.json ├── utils.mjs ├── wasm.js └── zotero-cmd-template.json ├── libs └── vector_search │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ └── src │ └── lib.rs ├── package-lock.json ├── package.json ├── patches ├── formdata-node+4.4.1.patch ├── marked+4.3.0.patch ├── node-domexception+1.0.0.patch ├── object-hash+3.0.0.patch ├── openai+4.72.0.patch ├── react-dom │ ├── index.js │ └── package.json ├── react-mentions+4.4.10.patch ├── react │ ├── index.js │ └── package.json ├── rollup-plugin-node-polyfills+0.2.1.patch ├── serialize-error+11.0.3.patch ├── uuid+9.0.1.patch └── yaml+2.6.0.patch ├── src ├── apis │ └── zotero │ │ ├── annotation.ts │ │ ├── citation.ts │ │ ├── collection.ts │ │ ├── controls │ │ └── search.ts │ │ ├── index.ts │ │ ├── item.ts │ │ ├── legacySearch.ts │ │ ├── note.ts │ │ ├── search.ts │ │ ├── suggest.ts │ │ ├── types.ts │ │ └── utils │ │ └── utils.ts ├── db │ ├── client.ts │ ├── db.ts │ └── store.ts ├── hooks │ ├── useAssistant.tsx │ ├── useDialog.tsx │ ├── useDragging.tsx │ ├── useFeedback.ts │ ├── useFunctionCalls.tsx │ ├── useLegacyMessages.ts │ ├── useMessages.ts │ ├── useNotification.tsx │ ├── useOutsideClick.ts │ ├── useScroll.tsx │ ├── useStates.tsx │ └── useZoom.ts ├── index.ts ├── models │ ├── agents │ │ ├── base.ts │ │ ├── index.ts │ │ ├── qa.bk.ts │ │ └── qa.ts │ ├── assistant.ts │ ├── cache.ts │ ├── chains │ │ ├── qa.ts │ │ ├── router.ts │ │ ├── search.ts │ │ ├── summary.ts │ │ └── vision.ts │ ├── legacyAssistant.ts │ ├── schemas │ │ ├── const.ts │ │ ├── routing.ts │ │ └── search.ts │ ├── tools.ts │ ├── tools │ │ ├── search.ts │ │ ├── zoteroCollection.ts │ │ ├── zoteroCreators.ts │ │ └── zoteroItem.ts │ ├── utils │ │ ├── actions.ts │ │ ├── callbacks.ts │ │ ├── dataTransfer.ts │ │ ├── error.ts │ │ ├── lcParsers.ts │ │ ├── memory.ts │ │ └── states.ts │ └── vectorstore │ │ ├── index.ts │ │ ├── vector_search.d.ts │ │ └── vector_search.js ├── modules │ └── messageStore.ts ├── settings │ ├── addon.ts │ ├── config.ts │ ├── hooks.ts │ └── preferences.ts ├── typings │ ├── actions.ts │ ├── files.ts │ ├── global.ts │ ├── input.ts │ ├── legacyMessages111.ts │ ├── messages.ts │ ├── steps.ts │ ├── workflows.ts │ └── zotero.ts ├── utils │ ├── concurrency.ts │ ├── constants.ts │ ├── datetime.ts │ ├── identifiers.ts │ ├── locale.ts │ ├── loggers.ts │ ├── messageStore.ts │ ├── parsers.ts │ ├── prefs.ts │ ├── wait.ts │ └── window.ts ├── views │ ├── Container.tsx │ ├── Providers.tsx │ ├── components │ │ ├── Version.tsx │ │ ├── annotations │ │ │ └── AnnotatedText.tsx │ │ ├── buttons │ │ │ ├── AnnotateButton.tsx │ │ │ ├── ButtonGroup.tsx │ │ │ ├── CopyButton.tsx │ │ │ ├── ItemButton.tsx │ │ │ ├── Link.tsx │ │ │ ├── LinkButton.tsx │ │ │ ├── NoteButton.tsx │ │ │ ├── StopRespondingButton.tsx │ │ │ └── types.ts │ │ ├── code │ │ │ └── CodeHighlighter.tsx │ │ ├── files │ │ │ ├── FileIndexer.tsx │ │ │ ├── FileRetriever.tsx │ │ │ ├── FileStatus.tsx │ │ │ ├── FileUploader.tsx │ │ │ └── FirePreparation.tsx │ │ ├── navigations │ │ │ ├── Confirmation.tsx │ │ │ ├── DropdownMenu.tsx │ │ │ └── Modal.tsx │ │ ├── search │ │ │ ├── SearchResultTable.tsx │ │ │ └── SearchStrategy.tsx │ │ ├── test │ │ │ └── data │ │ │ │ ├── qaResponse.ts │ │ │ │ ├── searchResults.ts │ │ │ │ └── urlMessage.ts │ │ └── types.ts │ ├── features │ │ ├── Feedback.tsx │ │ ├── Header.tsx │ │ ├── Notification.tsx │ │ ├── infoPanel │ │ │ ├── FAQ.tsx │ │ │ ├── InfoPanel.tsx │ │ │ └── PromptLibrary.tsx │ │ ├── input │ │ │ ├── DragArea.tsx │ │ │ ├── Input.tsx │ │ │ ├── States.tsx │ │ │ └── TextField.tsx │ │ ├── menus │ │ │ ├── MainMenu.tsx │ │ │ └── TestMenu.tsx │ │ └── messages │ │ │ ├── BotMessage.tsx │ │ │ ├── MessageControl.tsx │ │ │ ├── UserMessage.tsx │ │ │ ├── actions │ │ │ ├── ErrorAction.tsx │ │ │ ├── FileAction.tsx │ │ │ ├── Markdown.tsx │ │ │ ├── QAAction.tsx │ │ │ ├── RetryAction.tsx │ │ │ └── SearchAction.tsx │ │ │ ├── steps │ │ │ ├── ActionStep.tsx │ │ │ ├── ErrorStep.tsx │ │ │ ├── MessageStep.tsx │ │ │ ├── ToolStep.tsx │ │ │ └── WorkflowStep.tsx │ │ │ ├── widgets │ │ │ └── SearchResultsWidget.tsx │ │ │ └── workflows │ │ │ ├── QAWorkflow.tsx │ │ │ └── SearchWorkflow.tsx │ ├── icons │ │ ├── file.tsx │ │ ├── openai.tsx │ │ ├── style.css │ │ ├── ui.tsx │ │ └── zotero.tsx │ ├── root.ts │ ├── style.css │ └── utils │ │ ├── chatHistory.ts │ │ └── markdown.tsx └── workers │ └── dbWorkers.ts ├── tailwind.config.js ├── tests └── index.js ├── tsconfig.json └── zotero-plugin.config.ts /.gitattributes: -------------------------------------------------------------------------------- 1 | *.gif filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | logs 3 | node_modules 4 | zotero-cmd.json 5 | src/env.json 6 | tests/questions.txt 7 | debug*.* 8 | *.env 9 | *.log 10 | .DS_Store -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | build 3 | logs 4 | node_modules 5 | package-lock.json 6 | yarn.lock 7 | pnpm-lock.yaml -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Restart", 11 | "runtimeExecutable": "npm", 12 | "runtimeArgs": [ 13 | "run", 14 | "restart" 15 | ], 16 | }, 17 | { 18 | "type": "node", 19 | "request": "launch", 20 | "name": "Restart in Prod Mode", 21 | "runtimeExecutable": "npm", 22 | "runtimeArgs": [ 23 | "run", 24 | "restart-prod" 25 | ], 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /.vscode/toolkit.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "appendElement - full": { 3 | "scope": "javascript,typescript", 4 | "prefix": "appendElement", 5 | "body": [ 6 | "appendElement({", 7 | "\ttag: '${1:div}',", 8 | "\tid: '${2:id}',", 9 | "\tnamespace: '${3:html}',", 10 | "\tclassList: ['${4:class}'],", 11 | "\tstyles: {${5:style}: '$6'},", 12 | "\tproperties: {},", 13 | "\tattributes: {},", 14 | "\t[{ '${7:onload}', (e: Event) => $8, ${9:false} }],", 15 | "\tcheckExistanceParent: ${10:HTMLElement},", 16 | "\tignoreIfExists: ${11:true},", 17 | "\tskipIfExists: ${12:true},", 18 | "\tremoveIfExists: ${13:true},", 19 | "\tcustomCheck: (doc: Document, options: ElementOptions) => ${14:true},", 20 | "\tchildren: [$15]", 21 | "}, ${16:container});" 22 | ] 23 | }, 24 | "appendElement - minimum": { 25 | "scope": "javascript,typescript", 26 | "prefix": "appendElement", 27 | "body": "appendElement({ tag: '$1' }, $2);" 28 | }, 29 | "register Notifier": { 30 | "scope": "javascript,typescript", 31 | "prefix": "registerObserver", 32 | "body": [ 33 | "registerObserver({", 34 | "\t notify: (", 35 | "\t\tevent: _ZoteroTypes.Notifier.Event,", 36 | "\t\ttype: _ZoteroTypes.Notifier.Type,", 37 | "\t\tids: string[],", 38 | "\t\textraData: _ZoteroTypes.anyObj", 39 | "\t) => {", 40 | "\t\t$0", 41 | "\t}", 42 | "});" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /addon/chrome/content/icons/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/icons/favicon.png -------------------------------------------------------------------------------- /addon/chrome/content/icons/favicon@0.333x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/icons/favicon@0.333x.png -------------------------------------------------------------------------------- /addon/chrome/content/icons/favicon@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/icons/favicon@0.5x.png -------------------------------------------------------------------------------- /addon/chrome/content/icons/favicon@16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/icons/favicon@16x16.png -------------------------------------------------------------------------------- /addon/chrome/content/icons/favicon@4x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/icons/favicon@4x.png -------------------------------------------------------------------------------- /addon/chrome/content/icons/favicon@6x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/icons/favicon@6x.png -------------------------------------------------------------------------------- /addon/chrome/content/icons/openai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/icons/openai.png -------------------------------------------------------------------------------- /addon/chrome/content/libs/tiktoken_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/libs/tiktoken_bg.wasm -------------------------------------------------------------------------------- /addon/chrome/content/libs/vector_search_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifan0127/ai-research-assistant/9bbcd116f045587a9bc21b422e949b55e07e1cb6/addon/chrome/content/libs/vector_search_bg.wasm -------------------------------------------------------------------------------- /addon/chrome/content/popup.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 10 | 19 | 26 | 27 | 28 | 32 | 33 |