postor / chatpdf-minimal-demo

a minimal viable project of chatpdf
MIT License
600 stars 108 forks source link

chatpdf-minimal-demo

chatpdf 的最小实现,和文章对话 | mvp of chatpdf

此项目目的在于研究 chatpdf 实现原理 | this project aims at learn how to build app like chatpdf

screenshot

实现原理 | process flow

                   article/pdf                                    question
    /            /                        \                           |
piece1         piece2  ...........       piece(N)                     |
   |             |                         |                          |
embedding1     embedding2     ......     embeddingN                   |
   |             |                         |                          |
 --X-------------X---------.....-----------X-----------------   question_embedding  
   |             |                         |                          |
question       question                  question                     |
distance1      distance2                 distance(N)                  |
                 |                                                    |
               pick nearest piece                                     |
                  \                                                   /
                           \                          /
                               construct prompt
                                     |
                              get answer from ChatGPT

使用 | usage

docker compose up