[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Logseq AI #9318

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
fa24509
AI token setting
tiensonqin Mar 9, 2023
2f4f357
openai: chat
tiensonqin Mar 9, 2023
b265c50
Create blocks with question && answer
tiensonqin Mar 9, 2023
7c859ed
enhance: segmented text
tiensonqin Mar 9, 2023
2e926ae
fix: children should be a collection
tiensonqin Mar 15, 2023
5d9a3b2
Merge branch 'master' into feat/ai-lab
tiensonqin Apr 9, 2023
02c1d06
semantic search works!!
tiensonqin Apr 9, 2023
86a02a6
code clean
tiensonqin Apr 9, 2023
1b99520
speedup encode
tiensonqin Apr 10, 2023
888aa48
speed up encoding by using multiple processes
tiensonqin Apr 10, 2023
318644f
fix: query
tiensonqin Apr 10, 2023
661c3f8
fix: add graph parameter to q
tiensonqin Apr 10, 2023
af691a8
Merge branch 'master' into feat/ai-lab
tiensonqin Apr 27, 2023
3ee8a81
chats on the right sidebar
tiensonqin Apr 27, 2023
91e74a4
store conversations under /chats
tiensonqin Apr 27, 2023
7047c42
feat: openai stream completion
tiensonqin Apr 27, 2023
79d7a6c
enhance stream conversation ux
tiensonqin Apr 27, 2023
3837e37
enhance: send full conversation
tiensonqin Apr 27, 2023
9b4180a
fix: keep cursor in the chat input
tiensonqin Apr 27, 2023
8330817
enhance: highlight current conversation
tiensonqin Apr 27, 2023
74ebff7
enhance: user-friendly conversation title
tiensonqin Apr 27, 2023
1d5148a
enhance: render messages using the block content component
tiensonqin Apr 27, 2023
2c56509
enhance: editable block in conversation
tiensonqin Apr 27, 2023
aa33397
Better experience
tiensonqin Apr 27, 2023
dd86a71
Style tweaks
tiensonqin Apr 30, 2023
3d32a51
enhance: enable chat in the left
tiensonqin Apr 30, 2023
84cbded
feat: generate images in chat
tiensonqin Apr 30, 2023
8627e7f
wip: ai prompt
tiensonqin May 1, 2023
2cdc9e4
privacy: preview content before sending to any service
tiensonqin May 1, 2023
734266a
fix: don't split content for code block
tiensonqin May 1, 2023
af83525
Disable AI by default
tiensonqin May 1, 2023
fb7c275
typo
tiensonqin May 1, 2023
a31805a
Merge branch 'master' into feat/ai-lab
tiensonqin May 4, 2023
cb1a927
replace && insert works
tiensonqin May 4, 2023
66371b9
paste results from openai instead of creating a new block
tiensonqin May 4, 2023
4adf373
feat: translate
tiensonqin May 4, 2023
32c5149
feat: custom prompts
tiensonqin May 4, 2023
308d2c7
fix: remove non-matched limit
tiensonqin May 4, 2023
c4931a0
Merge branch 'master' into feat/ai-lab
tiensonqin May 5, 2023
1e8d1be
fix: duplicate key
tiensonqin May 5, 2023
9c3b32b
enhance: autosize chatbox input
tiensonqin May 5, 2023
30eb58c
enhance: add links for chat<->page
tiensonqin May 5, 2023
d7c180a
remove ai script
tiensonqin May 8, 2023
8dc3ad2
simplify ai protocol
tiensonqin May 8, 2023
ff78229
Langchain plugin example
tiensonqin May 9, 2023
795a9c8
ai proxy search engine implementation
tiensonqin May 9, 2023
d8adc9b
fix: wrong input
tiensonqin May 9, 2023
7121156
rename to plugin-example
tiensonqin May 9, 2023
521d34d
ai proxy semantic search works!!
tiensonqin May 9, 2023
1f3505a
Switch between ai services
tiensonqin May 9, 2023
484bc71
use db id as qdrant id
tiensonqin May 9, 2023
5661b94
valid conversation id
tiensonqin May 9, 2023
fc4e87a
fix: chatbox input
tiensonqin May 9, 2023
8298acf
add speech-to-text impl for openai
tiensonqin May 9, 2023
3f29456
feat: transcribe
tiensonqin May 9, 2023
088c271
feat: save ai-generate images locally
tiensonqin May 10, 2023
709a482
enhance: shortcuts for ai regenerate/replace/insert
tiensonqin May 10, 2023
d2cf025
ui: add background to answers
tiensonqin May 10, 2023
bcf35b7
Merge branch 'master' into feat/ai-lab
tiensonqin May 18, 2023
7e04374
enhance(ux): right click to select a block
tiensonqin May 18, 2023
b79815c
enhance(ux): highlight block when exit editing
tiensonqin May 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enhance: editable block in conversation
  • Loading branch information
tiensonqin committed Apr 27, 2023
commit 2c56509bbf8d6052348e9cb65b83254cb5b9c780
5 changes: 1 addition & 4 deletions src/main/frontend/commands.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,7 @@
(cond
(and (util/electron?) (config/local-db? (state/get-current-repo)))

["Upload an asset" [[:editor/click-hidden-file-input :id]] "Upload file types like image, pdf, docx, etc.)"]

;; ["Upload an image" [[:editor/click-hidden-file-input :id]]]
)]
["Upload an asset" [[:editor/click-hidden-file-input :id]] "Upload file types like image, pdf, docx, etc.)"])]

(headings)

Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/components/ai.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
(rum/defc conversation-message < rum/static
[block]
[:div.message {:class (get-in block [:block/properties :logseq.ai.type])}
(block/block-content {} (db/pull (:db/id block)) nil nil false)])
(block/single-block-cp (:block/uuid block))])

(rum/defcs conversation < rum/reactive
[state conversation-id]
Expand Down
27 changes: 2 additions & 25 deletions src/main/frontend/components/editor.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
(and
(not (fn? command-steps))
(not (contains? (set (map first command-steps)) :editor/input))
(not (contains? #{"Date picker" "Template" "Deadline" "Scheduled" "Upload an image"} command))))]
(not (contains? #{"Date picker" "Template" "Deadline" "Scheduled"} command))))]
(editor-handler/insert-command! id command-steps
format
{:restore? restore-slash?
Expand Down Expand Up @@ -416,26 +416,6 @@
:exit 300}}
(absolute-modal cp modal-name set-default-width? pos))))

(rum/defc image-uploader < rum/reactive
[id format]
[:div.image-uploader
[:input
{:id "upload-file"
:type "file"
:on-change (fn [e]
(let [files (.-files (.-target e))]
(editor-handler/upload-asset id files format editor-handler/*asset-uploading? false)))
:hidden true}]
#_:clj-kondo/ignore
(when-let [uploading? (util/react editor-handler/*asset-uploading?)]
(let [processing (util/react editor-handler/*asset-uploading-process)]
(transition-cp
[:div.flex.flex-row.align-center.rounded-md.shadow-sm.bg-base-2.px-1.py-1
(ui/loading
(util/format "Uploading %s%" (util/format "%2d" processing)))]
"upload-file"
false)))])

(defn- set-up-key-down!
[state format]
(mixins/on-key-down
Expand Down Expand Up @@ -618,7 +598,4 @@
:class heading-class})

(mock-textarea content)
(modals id format)

(when format
(image-uploader id format))]))
(modals id format)]))