{"id":30539,"date":"2025-04-18T09:16:46","date_gmt":"2025-04-18T01:16:46","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=30539"},"modified":"2025-08-23T03:20:54","modified_gmt":"2025-08-22T19:20:54","slug":"onefilellm","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/de\/onefilellm\/","title":{"rendered":"OneFileLLM\uff1a\u6574\u5408\u591a\u79cd\u6570\u636e\u6e90\u4e3a\u5355\u4e00\u6587\u672c\u6587\u4ef6"},"content":{"rendered":"<p>OneFileLLM \u662f\u4e00\u4e2a\u5f00\u6e90\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u65e8\u5728\u5c06\u591a\u79cd\u6570\u636e\u6e90\u6574\u5408\u6210\u5355\u4e00\u6587\u672c\u6587\u4ef6\uff0c\u65b9\u4fbf\u8f93\u5165\u5927\u8bed\u8a00\u6a21\u578b\uff08LLM\uff09\u3002\u5b83\u652f\u6301\u5904\u7406 GitHub \u4ed3\u5e93\u3001ArXiv \u8bba\u6587\u3001YouTube \u89c6\u9891\u8f6c\u5f55\u3001\u7f51\u9875\u5185\u5bb9\u3001Sci-Hub \u8bba\u6587\u548c\u672c\u5730\u6587\u4ef6\uff0c\u81ea\u52a8\u751f\u6210\u7ed3\u6784\u5316\u6587\u672c\u5e76\u590d\u5236\u5230\u526a\u8d34\u677f\u3002\u5f00\u53d1\u8005 Jim McMillan \u8bbe\u8ba1\u6b64\u5de5\u5177\u4ee5\u7b80\u5316 LLM \u63d0\u793a\u521b\u5efa\uff0c\u51cf\u5c11\u624b\u52a8\u6574\u7406\u6570\u636e\u7684\u7e41\u7410\u5de5\u4f5c\u3002\u5de5\u5177\u4f7f\u7528 Python \u5f00\u53d1\uff0c\u652f\u6301\u591a\u79cd\u6587\u4ef6\u683c\u5f0f\u3001\u6587\u672c\u9884\u5904\u7406\u548c XML \u5c01\u88c5\uff0c\u9002\u5408\u5f00\u53d1\u8005\u3001\u7814\u7a76\u4eba\u5458\u548c\u5185\u5bb9\u521b\u4f5c\u8005\u4f7f\u7528\u3002\u5b89\u88c5\u7b80\u5355\uff0c\u914d\u7f6e\u7075\u6d3b\uff0c\u53ef\u901a\u8fc7\u547d\u4ee4\u884c\u6216\u7f51\u9875\u754c\u9762\u64cd\u4f5c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-30540\" title=\"OneFileLLM\uff1a\u6574\u5408\u591a\u79cd\u6570\u636e\u6e90\u4e3a\u5355\u4e00\u6587\u672c\u6587\u4ef6-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/ef9525ad16e06e7.jpg\" alt=\"OneFileLLM\uff1a\u6574\u5408\u591a\u79cd\u6570\u636e\u6e90\u4e3a\u5355\u4e00\u6587\u672c\u6587\u4ef6-1\" width=\"1056\" height=\"1018\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/ef9525ad16e06e7.jpg 1851w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/ef9525ad16e06e7-768x740.jpg 768w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/ef9525ad16e06e7-1536x1480.jpg 1536w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/04\/ef9525ad16e06e7-12x12.jpg 12w\" sizes=\"auto, (max-width: 1056px) 100vw, 1056px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li>\u81ea\u52a8\u68c0\u6d4b\u8f93\u5165\u7c7b\u578b\uff08\u5982 GitHub \u4ed3\u5e93\u3001YouTube \u94fe\u63a5\u3001ArXiv \u8bba\u6587\u3001\u672c\u5730\u6587\u4ef6\u7b49\uff09\u3002<\/li>\n<li>\u652f\u6301\u5904\u7406 GitHub \u4ed3\u5e93\u3001\u62c9\u53d6\u8bf7\u6c42\uff08Pull Request\uff09\u3001\u95ee\u9898\uff08Issue\uff09\uff0c\u6574\u5408\u4e3a\u5355\u4e00\u6587\u672c\u3002<\/li>\n<li>\u63d0\u53d6 ArXiv \u548c Sci-Hub \u8bba\u6587 PDF \u5185\u5bb9\u5e76\u8f6c\u4e3a\u6587\u672c\u3002<\/li>\n<li>\u83b7\u53d6 YouTube \u89c6\u9891\u8f6c\u5f55\u6587\u672c\u3002<\/li>\n<li>\u6293\u53d6\u7f51\u9875\u5185\u5bb9\uff0c\u652f\u6301\u6307\u5b9a\u6df1\u5ea6\u722c\u53d6\u94fe\u63a5\u3002<\/li>\n<li>\u5904\u7406\u591a\u79cd\u6587\u4ef6\u683c\u5f0f\uff0c\u5305\u62ec\u00a0<code>.py<\/code>\u3001<code>.ipynb<\/code>\u3001<code>.txt<\/code>\u3001<code>.md<\/code>\u3001<code>.pdf<\/code>\u3001<code>.csv<\/code>\u00a0\u7b49\u3002<\/li>\n<li>\u63d0\u4f9b\u6587\u672c\u9884\u5904\u7406\uff0c\u5982\u53bb\u9664\u505c\u7528\u8bcd\u3001\u6807\u70b9\u3001\u8f6c\u6362\u4e3a\u5c0f\u5199\u3002<\/li>\n<li>\u652f\u6301\u6587\u4ef6\u548c\u76ee\u5f55\u6392\u9664\uff0c\u8fc7\u6ee4\u81ea\u52a8\u751f\u6210\u6587\u4ef6\uff08\u5982\u00a0<code>*.pb.go<\/code>\uff09\u6216\u6d4b\u8bd5\u76ee\u5f55\u3002<\/li>\n<li>\u62a5\u544a\u538b\u7f29\u548c\u672a\u538b\u7f29\u6587\u672c\u7684\u4ee4\u724c\u6570\uff0c\u4f18\u5316 LLM \u4e0a\u4e0b\u6587\u7ba1\u7406\u3002<\/li>\n<li>\u8f93\u51fa\u6587\u672c\u5c01\u88c5\u4e3a XML \u683c\u5f0f\uff0c\u63d0\u5347 LLM \u5904\u7406\u6548\u7387\u3002<\/li>\n<li>\u81ea\u52a8\u590d\u5236\u672a\u538b\u7f29\u6587\u672c\u5230\u526a\u8d34\u677f\uff0c\u65b9\u4fbf\u7c98\u8d34\u5230 LLM \u5e73\u53f0\u3002<\/li>\n<li>\u63d0\u4f9b Flask \u7f51\u9875\u754c\u9762\uff0c\u7b80\u5316 URL \u6216\u8def\u5f84\u8f93\u5165\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5\u6d41\u7a0b<\/h3>\n<p>OneFileLLM \u9700\u8981 Python \u73af\u5883\u548c\u76f8\u5173\u4f9d\u8d56\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u5b89\u88c5\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li><strong>\u514b\u9686\u4ed3\u5e93<\/strong><br \/>\n\u5728\u7ec8\u7aef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u514b\u9686 OneFileLLM \u4ed3\u5e93\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/jimmc414\/onefilellm.git\r\ncd onefilellm\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong>\uff08\u63a8\u8350\uff09<br \/>\n\u4e3a\u907f\u514d\u4f9d\u8d56\u51b2\u7a81\uff0c\u5efa\u8bae\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<pre><code>python -m venv .venv\r\nsource .venv\/bin\/activate  # Windows \u4f7f\u7528 .venv\\Scripts\\activate\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u5b89\u88c5\u4f9d\u8d56<\/strong><br \/>\n\u5b89\u88c5\u00a0<code>requirements.txt<\/code>\u00a0\u4e2d\u5217\u51fa\u7684\u4f9d\u8d56\uff1a<\/p>\n<pre><code>pip install -U -r requirements.txt\r\n<\/code><\/pre>\n<p>\u4f9d\u8d56\u5305\u62ec\u00a0<code>PyPDF2<\/code>\uff08PDF \u5904\u7406\uff09\u3001<code>BeautifulSoup<\/code>\uff08\u7f51\u9875\u6293\u53d6\uff09\u3001<code>tiktoken<\/code>\uff08\u4ee4\u724c\u8ba1\u6570\uff09\u3001<code>pyperclip<\/code>\uff08\u526a\u8d34\u677f\u64cd\u4f5c\uff09\u3001<code>youtube-transcript-api<\/code>\uff08YouTube \u8f6c\u5f55\uff09\u7b49\u3002<\/li>\n<li><strong>\u914d\u7f6e GitHub \u8bbf\u95ee\u4ee4\u724c<\/strong>\uff08\u53ef\u9009\uff09<br \/>\n\u82e5\u9700\u8bbf\u95ee\u79c1\u6709 GitHub \u4ed3\u5e93\uff0c\u9700\u8bbe\u7f6e\u4e2a\u4eba\u8bbf\u95ee\u4ee4\u724c\uff1a<\/p>\n<ul>\n<li>\u767b\u5f55 GitHub\uff0c\u8fdb\u5165\u201c\u8bbe\u7f6e &gt; \u5f00\u53d1\u8005\u8bbe\u7f6e &gt; \u4e2a\u4eba\u8bbf\u95ee\u4ee4\u724c\u201d\u3002<\/li>\n<li>\u751f\u6210\u65b0\u4ee4\u724c\uff0c\u9009\u62e9\u00a0<code>repo<\/code>\uff08\u79c1\u6709\u4ed3\u5e93\uff09\u6216\u00a0<code>public_repo<\/code>\uff08\u516c\u5f00\u4ed3\u5e93\uff09\u6743\u9650\u3002<\/li>\n<li>\u5c06\u4ee4\u724c\u8bbe\u4e3a\u73af\u5883\u53d8\u91cf\uff1a\n<pre><code>export GITHUB_TOKEN=&lt;your-token&gt;  # Windows \u4f7f\u7528 set GITHUB_TOKEN=&lt;your-token&gt;\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong><br \/>\n\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<pre><code>python onefilellm.py --help\r\n<\/code><\/pre>\n<p>\u82e5\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\uff0c\u8bf4\u660e\u5b89\u88c5\u6b63\u786e\u3002<\/li>\n<\/ol>\n<h3>\u8fd0\u884c\u65b9\u5f0f<\/h3>\n<p>OneFileLLM \u652f\u6301\u547d\u4ee4\u884c\u548c\u7f51\u9875\u754c\u9762\u4e24\u79cd\u64cd\u4f5c\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li><strong>\u547d\u4ee4\u884c\u6a21\u5f0f<\/strong><br \/>\n\u8fd0\u884c\u4e3b\u811a\u672c\u5e76\u624b\u52a8\u8f93\u5165 URL \u6216\u8def\u5f84\uff1a<\/p>\n<pre><code>python onefilellm.py\r\n<\/code><\/pre>\n<p>\u6216\u76f4\u63a5\u5728\u547d\u4ee4\u884c\u6307\u5b9a URL\/\u8def\u5f84\uff1a<\/p>\n<pre><code>python onefilellm.py https:\/\/github.com\/jimmc414\/onefilellm\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u7f51\u9875\u754c\u9762\u6a21\u5f0f<\/strong><br \/>\n\u8fd0\u884c Flask \u7f51\u9875\u754c\u9762\uff1a<\/p>\n<pre><code>python onefilellm.py --web\r\n<\/code><\/pre>\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8bbf\u95ee\u00a0<code>http:\/\/localhost:5000<\/code>\uff0c\u8f93\u5165 URL \u6216\u8def\u5f84\uff0c\u70b9\u51fb\u201c\u5904\u7406\u201d\u83b7\u53d6\u8f93\u51fa\u3002<\/li>\n<\/ul>\n<h3>\u4e3b\u8981\u529f\u80fd\u64cd\u4f5c<\/h3>\n<p>OneFileLLM \u7684\u6838\u5fc3\u662f\u5c06\u591a\u79cd\u6570\u636e\u6e90\u6574\u5408\u4e3a\u5355\u4e00\u6587\u672c\uff0c\u8f93\u51fa\u4e3a\u00a0<code>uncompressed_output.txt<\/code>\uff08\u672a\u538b\u7f29\uff09\u3001<code>compressed_output.txt<\/code>\uff08\u538b\u7f29\uff09\u548c\u00a0<code>processed_urls.txt<\/code>\uff08\u722c\u53d6 URL \u5217\u8868\uff09\u3002\u4ee5\u4e0b\u662f\u4e3b\u8981\u529f\u80fd\u7684\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li><strong>\u5904\u7406 GitHub \u4ed3\u5e93<\/strong><br \/>\n\u8f93\u5165\u4ed3\u5e93 URL\uff08\u5982\u00a0<code>https:\/\/github.com\/jimmc414\/onefilellm<\/code>\uff09\uff0c\u5de5\u5177\u9012\u5f52\u83b7\u53d6\u652f\u6301\u7684\u6587\u4ef6\u7c7b\u578b\uff08\u5982\u00a0<code>.py<\/code>\u3001<code>.md<\/code>\uff09\uff0c\u6574\u5408\u4e3a\u5355\u4e00\u6587\u672c\u3002<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<pre><code>python onefilellm.py\r\nEnter URL or path: https:\/\/github.com\/jimmc414\/onefilellm\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\u6587\u4ef6\u5305\u542b\u4ed3\u5e93\u6587\u4ef6\u5185\u5bb9\uff0cXML \u5c01\u88c5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code>&lt;source type=\"github_repository\"&gt;\r\n&lt;content&gt;\r\n[\u6587\u4ef6\u5185\u5bb9]\r\n&lt;\/content&gt;\r\n&lt;\/source&gt;\r\n<\/code><\/pre>\n<p>\u6587\u672c\u81ea\u52a8\u590d\u5236\u5230\u526a\u8d34\u677f\u3002<\/li>\n<li><strong>\u5904\u7406 GitHub \u62c9\u53d6\u8bf7\u6c42\u6216\u95ee\u9898<\/strong><br \/>\n\u8f93\u5165\u62c9\u53d6\u8bf7\u6c42\uff08\u5982\u00a0<code>https:\/\/github.com\/dear-github\/dear-github\/pull\/102<\/code>\uff09\u6216\u95ee\u9898 URL\uff08\u5982\u00a0<code>https:\/\/github.com\/isaacs\/github\/issues\/1191<\/code>\uff09\uff0c\u5de5\u5177\u63d0\u53d6\u5dee\u5f02\u8be6\u60c5\u3001\u8bc4\u8bba\u548c\u6574\u4e2a\u4ed3\u5e93\u5185\u5bb9\u3002<br \/>\n\u793a\u4f8b\u8f93\u51fa\u5305\u62ec\u4ee3\u7801\u53d8\u66f4\u3001\u8bc4\u8bba\u548c\u76f8\u5173\u6587\u4ef6\uff0c\u5c01\u88c5\u4e3a\uff1a<\/p>\n<pre><code>&lt;source type=\"github_pull_request\"&gt;\r\n&lt;content&gt;\r\n[\u5dee\u5f02\u8be6\u60c5\u548c\u8bc4\u8bba]\r\n&lt;\/content&gt;\r\n&lt;\/source&gt;\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u63d0\u53d6 ArXiv \u6216 Sci-Hub \u8bba\u6587<\/strong><br \/>\n\u8f93\u5165 ArXiv URL\uff08\u5982\u00a0<code>https:\/\/arxiv.org\/abs\/2401.14295<\/code>\uff09\u6216 Sci-Hub DOI\/PMID\uff08\u5982\u00a0<code>10.1053\/j.ajkd.2017.08.002<\/code>\u00a0\u6216\u00a0<code>29203127<\/code>\uff09\uff0c\u5de5\u5177\u5c06 PDF \u8f6c\u4e3a\u6587\u672c\u3002<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<pre><code>Enter URL or path: https:\/\/arxiv.org\/abs\/2401.14295\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\u4e3a XML \u5c01\u88c5\u7684\u8bba\u6587\u6587\u672c\uff1a<\/p>\n<pre><code>&lt;source type=\"arxiv_paper\"&gt;\r\n&lt;content&gt;\r\n[\u8bba\u6587\u5185\u5bb9]\r\n&lt;\/content&gt;\r\n&lt;\/source&gt;\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u83b7\u53d6 YouTube \u8f6c\u5f55<\/strong><br \/>\n\u8f93\u5165 YouTube \u89c6\u9891 URL\uff08\u5982\u00a0<code>https:\/\/www.youtube.com\/watch?v=KZ_NlnmPQYk<\/code>\uff09\uff0c\u5de5\u5177\u63d0\u53d6\u8f6c\u5f55\u6587\u672c\u3002<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<pre><code>Enter URL or path: https:\/\/www.youtube.com\/watch?v=KZ_NlnmPQYk\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\u4e3a\uff1a<\/p>\n<pre><code>&lt;source type=\"youtube_transcript\"&gt;\r\n&lt;content&gt;\r\n[\u8f6c\u5f55\u5185\u5bb9]\r\n&lt;\/content&gt;\r\n&lt;\/source&gt;\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u7f51\u9875\u6293\u53d6<\/strong><br \/>\n\u8f93\u5165\u7f51\u9875 URL\uff08\u5982\u00a0<code>https:\/\/llm.datasette.io\/en\/stable\/<\/code>\uff09\uff0c\u5de5\u5177\u6293\u53d6\u9875\u9762\u53ca\u6307\u5b9a\u6df1\u5ea6\u94fe\u63a5\uff08\u9ed8\u8ba4\u00a0<code>max_depth=2<\/code>\uff09\u3002<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<pre><code>Enter URL or path: https:\/\/llm.datasette.io\/en\/stable\/\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\u4e3a\u5206\u6bb5\u7f51\u9875\u6587\u672c\uff0c\u5c01\u88c5\u4e3a\uff1a<\/p>\n<pre><code>&lt;source type=\"web_documentation\"&gt;\r\n&lt;content&gt;\r\n[\u7f51\u9875\u5185\u5bb9]\r\n&lt;\/content&gt;\r\n&lt;\/source&gt;\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u5904\u7406\u672c\u5730\u6587\u4ef6\u6216\u76ee\u5f55<\/strong><br \/>\n\u8f93\u5165\u672c\u5730\u6587\u4ef6\u8def\u5f84\uff08\u5982\u00a0<code>C:\\documents\\report.pdf<\/code>\uff09\u6216\u76ee\u5f55\uff08\u5982\u00a0<code>C:\\projects\\research<\/code>\uff09\uff0c\u5de5\u5177\u63d0\u53d6\u5185\u5bb9\u6216\u6574\u5408\u76ee\u5f55\u4e2d\u652f\u6301\u7684\u6587\u4ef6\u7c7b\u578b\u3002<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<pre><code>Enter URL or path: C:\\projects\\research\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\u4e3a XML \u5c01\u88c5\u7684\u76ee\u5f55\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<h3>\u7279\u8272\u529f\u80fd\u64cd\u4f5c<\/h3>\n<ul>\n<li><strong>XML \u8f93\u51fa\u5c01\u88c5<\/strong><br \/>\n\u6240\u6709\u8f93\u51fa\u91c7\u7528 XML \u683c\u5f0f\uff0c\u7ed3\u6784\u6e05\u6670\uff0c\u63d0\u5347 LLM \u5904\u7406\u6548\u7387\u3002\u683c\u5f0f\u5982\uff1a<\/p>\n<pre><code>&lt;source type=\"[source_type]\"&gt;\r\n&lt;content&gt;\r\n[\u5185\u5bb9]\r\n&lt;\/content&gt;\r\n&lt;\/source&gt;\r\n<\/code><\/pre>\n<p>\u5176\u4e2d\u00a0<code>source_type<\/code>\u00a0\u5305\u62ec\u00a0<code>github_repository<\/code>\u3001<code>arxiv_paper<\/code>\u00a0\u7b49\u3002<\/li>\n<li><strong>\u6587\u4ef6\u548c\u76ee\u5f55\u6392\u9664<\/strong><br \/>\n\u652f\u6301\u6392\u9664\u7279\u5b9a\u6587\u4ef6\uff08\u5982\u00a0<code>*.pb.go<\/code>\uff09\u548c\u76ee\u5f55\uff08\u5982\u00a0<code>tests<\/code>\uff09\u3002\u4fee\u6539\u00a0<code>onefilellm.py<\/code>\u00a0\u4e2d\u7684\u00a0<code>excluded_patterns<\/code>\u00a0\u548c\u00a0<code>EXCLUDED_DIRS<\/code>\u00a0\u5217\u8868\uff1a<\/p>\n<pre><code>excluded_patterns = ['*.pb.go', '*_test.go']\r\nEXCLUDED_DIRS = ['tests', 'mocks']\r\n<\/code><\/pre>\n<p>\u8fd9\u51cf\u5c11\u65e0\u5173\u5185\u5bb9\uff0c\u4f18\u5316\u4ee4\u724c\u4f7f\u7528\u3002<\/li>\n<li><strong>\u4ee4\u724c\u8ba1\u6570<\/strong><br \/>\n\u4f7f\u7528\u00a0<code>tiktoken<\/code>\u00a0\u8ba1\u7b97\u538b\u7f29\u548c\u672a\u538b\u7f29\u6587\u672c\u7684\u4ee4\u724c\u6570\uff0c\u663e\u793a\u5728\u63a7\u5236\u53f0\uff1a<\/p>\n<pre><code>Uncompressed <a href=\"https:\/\/www.kdjingpai.com\/en\/tokenization\/\">token<\/a> count: 1234\r\nCompressed token count: 567\r\n<\/code><\/pre>\n<p>\u5e2e\u52a9\u7528\u6237\u786e\u4fdd\u6587\u672c\u9002\u5408 LLM \u4e0a\u4e0b\u6587\u7a97\u53e3\u3002<\/li>\n<li><strong>\u6587\u672c\u9884\u5904\u7406<\/strong><br \/>\n\u5de5\u5177\u81ea\u52a8\u53bb\u9664\u505c\u7528\u8bcd\u3001\u6807\u70b9\uff0c\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u751f\u6210\u538b\u7f29\u8f93\u51fa\u3002\u7528\u6237\u53ef\u4fee\u6539\u00a0<code>preprocess_text<\/code>\u00a0\u51fd\u6570\u81ea\u5b9a\u4e49\u5904\u7406\u903b\u8f91\u3002<\/li>\n<li><strong>\u526a\u8d34\u677f\u96c6\u6210<\/strong><br \/>\n\u672a\u538b\u7f29\u8f93\u51fa\u81ea\u52a8\u590d\u5236\u5230\u526a\u8d34\u677f\uff0c\u76f4\u63a5\u7c98\u8d34\u5230 LLM \u5e73\u53f0\uff08\u5982 ChatGPT\u3001Claude\uff09\u3002<\/li>\n<li><strong>\u7f51\u9875\u754c\u9762<\/strong><br \/>\nFlask \u754c\u9762\u7b80\u5316\u64cd\u4f5c\uff0c\u7528\u6237\u8f93\u5165 URL \u6216\u8def\u5f84\uff0c\u4e0b\u8f7d\u8f93\u51fa\u6587\u4ef6\u6216\u590d\u5236\u6587\u672c\u3002\u9002\u5408\u975e\u6280\u672f\u7528\u6237\u3002<\/li>\n<\/ul>\n<h3>\u81ea\u5b9a\u4e49\u914d\u7f6e<\/h3>\n<ul>\n<li><strong>\u6587\u4ef6\u7c7b\u578b<\/strong><br \/>\n\u4fee\u6539\u00a0<code>allowed_extensions<\/code>\u00a0\u5217\u8868\uff0c\u6dfb\u52a0\u6216\u5220\u9664\u652f\u6301\u7684\u6587\u4ef6\u7c7b\u578b\uff1a<\/p>\n<pre><code>allowed_extensions = ['.py', '.txt', '.md', '.ipynb', '.csv']\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u7f51\u9875\u722c\u53d6\u6df1\u5ea6<\/strong><br \/>\n\u4fee\u6539\u00a0<code>max_depth<\/code>\u00a0\u53c2\u6570\uff0c\u9ed8\u8ba4\u503c\u4e3a 2\uff1a<\/p>\n<pre><code>max_depth = 2\r\n<\/code><\/pre>\n<\/li>\n<li><strong>Sci-Hub \u57df\u540d<\/strong><br \/>\n\u82e5 Sci-Hub \u57df\u540d\u4e0d\u53ef\u7528\uff0c\u4fee\u6539\u00a0<code>onefilellm.py<\/code>\u00a0\u4e2d\u7684 Sci-Hub URL\u3002<\/li>\n<\/ul>\n<h3>\u6ce8\u610f\u4e8b\u9879<\/h3>\n<ul>\n<li>\u786e\u4fdd\u7f51\u7edc\u8fde\u63a5\u7a33\u5b9a\uff0cYouTube \u8f6c\u5f55\u548c Sci-Hub \u8bbf\u95ee\u4f9d\u8d56\u5916\u90e8 API\u3002<\/li>\n<li>\u5927\u578b\u4ed3\u5e93\u6216\u7f51\u9875\u53ef\u80fd\u751f\u6210\u8f83\u5927\u8f93\u51fa\uff0c\u5efa\u8bae\u68c0\u67e5\u4ee4\u724c\u6570\u5e76\u8c03\u6574\u6392\u9664\u89c4\u5219\u3002<\/li>\n<li>Sci-Hub \u8bbf\u95ee\u53ef\u80fd\u56e0\u5730\u533a\u9650\u5236\u9700\u66f4\u6362\u57df\u540d\u3002<\/li>\n<li>\u90e8\u5206\u6587\u4ef6\u683c\u5f0f\uff08\u5982\u52a0\u5bc6 PDF\uff09\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u5e94\u7528\u573a\u666f<\/h2>\n<ol>\n<li><strong>\u4ee3\u7801\u5ba1\u67e5<\/strong><br \/>\n\u5f00\u53d1\u8005\u8f93\u5165 GitHub \u4ed3\u5e93\u6216\u62c9\u53d6\u8bf7\u6c42 URL\uff0c\u751f\u6210\u5305\u542b\u4ee3\u7801\u548c\u8bc4\u8bba\u7684\u6587\u672c\uff0c\u8f93\u5165 LLM \u5206\u6790\u4ee3\u7801\u8d28\u91cf\u6216\u4f18\u5316\u5efa\u8bae\u3002<\/li>\n<li><strong>\u8bba\u6587\u603b\u7ed3<\/strong><br \/>\n\u7814\u7a76\u4eba\u5458\u8f93\u5165 ArXiv \u6216 Sci-Hub \u8bba\u6587 URL\uff0c\u63d0\u53d6\u6587\u672c\u540e\u8f93\u5165 LLM \u751f\u6210\u6458\u8981\u6216\u56de\u7b54\u7814\u7a76\u95ee\u9898\u3002<\/li>\n<li><strong>\u89c6\u9891\u5185\u5bb9\u6574\u7406<\/strong><br \/>\n\u5185\u5bb9\u521b\u4f5c\u8005\u8f93\u5165 YouTube \u89c6\u9891 URL\uff0c\u83b7\u53d6\u8f6c\u5f55\u6587\u672c\uff0c\u8f93\u5165 LLM \u63d0\u53d6\u8981\u70b9\u6216\u751f\u6210\u811a\u672c\u3002<\/li>\n<li><strong>\u6587\u6863\u6574\u5408<\/strong><br \/>\n\u6280\u672f\u5199\u4f5c\u8005\u8f93\u5165\u7f51\u9875\u6216\u672c\u5730\u76ee\u5f55\u8def\u5f84\uff0c\u6574\u5408\u6587\u6863\u5185\u5bb9\uff0c\u8f93\u5165 LLM \u6539\u5199\u6216\u751f\u6210\u62a5\u544a\u3002<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>QA<\/h2>\n<ol>\n<li><strong>OneFileLLM \u652f\u6301\u54ea\u4e9b\u6587\u4ef6\u683c\u5f0f\uff1f<\/strong><br \/>\n\u652f\u6301\u00a0<code>.py<\/code>\u3001<code>.ipynb<\/code>\u3001<code>.txt<\/code>\u3001<code>.md<\/code>\u3001<code>.pdf<\/code>\u3001<code>.csv<\/code>\u00a0\u7b49\uff0c\u53ef\u901a\u8fc7\u4fee\u6539\u00a0<code>allowed_extensions<\/code>\u00a0\u81ea\u5b9a\u4e49\u3002<\/li>\n<li><strong>\u5982\u4f55\u8bbf\u95ee\u79c1\u6709 GitHub \u4ed3\u5e93\uff1f<\/strong><br \/>\n\u8bbe\u7f6e GitHub \u4e2a\u4eba\u8bbf\u95ee\u4ee4\u724c\u4e3a\u73af\u5883\u53d8\u91cf\u00a0<code>GITHUB_TOKEN<\/code>\uff0c\u9700\u00a0<code>repo<\/code>\u00a0\u6743\u9650\u3002<\/li>\n<li><strong>\u5982\u4f55\u51cf\u5c11\u8f93\u51fa\u6587\u672c\u5927\u5c0f\uff1f<\/strong><br \/>\n\u4fee\u6539\u00a0<code>excluded_patterns<\/code>\u00a0\u548c\u00a0<code>EXCLUDED_DIRS<\/code>\u00a0\u6392\u9664\u65e0\u5173\u6587\u4ef6\uff0c\u8c03\u6574\u00a0<code>max_depth<\/code>\u00a0\u9650\u5236\u7f51\u9875\u722c\u53d6\u6df1\u5ea6\u3002<\/li>\n<li><strong>XML \u8f93\u51fa\u6709\u4ec0\u4e48\u4f18\u52bf\uff1f<\/strong><br \/>\nXML \u7ed3\u6784\u6e05\u6670\uff0c\u6807\u8bb0\u5185\u5bb9\u6765\u6e90\u548c\u7c7b\u578b\uff0c\u63d0\u5347 LLM \u5bf9\u590d\u6742\u8f93\u5165\u7684\u7406\u89e3\u548c\u5904\u7406\u80fd\u529b\u3002<\/li>\n<li><strong>Sci-Hub \u8bba\u6587\u65e0\u6cd5\u4e0b\u8f7d\u600e\u4e48\u529e\uff1f<\/strong><br \/>\n\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\uff0c\u786e\u8ba4 DOI\/PMID \u6b63\u786e\uff0c\u6216\u66f4\u65b0\u00a0<code>onefilellm.py<\/code>\u00a0\u4e2d\u7684 Sci-Hub \u57df\u540d\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>OneFileLLM \u662f\u4e00\u4e2a\u5f00\u6e90\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u65e8\u5728\u5c06\u591a\u79cd\u6570\u636e\u6e90\u6574\u5408\u6210\u5355\u4e00\u6587\u672c\u6587\u4ef6\uff0c\u65b9\u4fbf\u8f93\u5165\u5927\u8bed\u8a00\u6a21\u578b\uff08LLM\uff09\u3002\u5b83\u652f\u6301\u5904\u7406 GitHub \u4ed3\u5e93\u3001ArXiv \u8bba\u6587\u3001YouTube \u89c6\u9891\u8f6c\u5f55\u3001\u7f51\u9875\u5185\u5bb9\u3001Sci-Hub \u8bba\u6587\u548c\u672c\u5730\u6587\u4ef6\uff0c\u81ea\u52a8\u751f\u6210\u7ed3\u6784&#8230;<\/p>\n","protected":false},"author":1,"featured_media":32782,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,499],"tags":[230,252],"class_list":["post-30539","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","category-document-extraction","tag-aikaiyuanxiangmu","tag-markdown"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/30539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/comments?post=30539"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/30539\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media\/32782"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media?parent=30539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/categories?post=30539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/tags?post=30539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}