DeepSite 是 Hugging Face 平台上一个流行的应用程序,它允许用户通过自然语言描述生成代码,实现氛围编程(Vibe coding)。DeepSite 使用了最新版本的 DeepSeek-V3-0324 模型,支持用户通过自然语言描述来生成代码,无需手动编写复杂的代码。介绍见:体验Hugging Face 平台上的DeepSite,实现氛围编程(Vibe coding)-CSDN博客
官方体验:DeepSite - a Hugging Face Space by enzostvs
但是官方在Huggingface,需要科学上网。有些小伙伴就会问了:
小白怎么把Huggingface上的DeepSite 部署到本地?
先上结论
最简单的办法,是直接git clone我改好的版本,然后修改里面的openai的base_url、key和模型名字,npm 安装,npm start启动服务即可。
复杂点的办法,下载次官方的代码,然后修改里面的三个文件server.js package.json 和package-lock.json,让其跟Huggingface解耦并支持自定义llm模型调用即可。
最简单操作:直接部署已修改版本到本地
git clone下载源码到本地
git clone https://github.com/skywalk163/deepsite
进入目录
cd deepsite
修改llm配置
修改server.js文件里从262句开始的base_url、key和模型名字,参考:
const openai = new OpenAI({
baseURL: 'http://192.168.1.5:1337/v1',
apiKey: 'your-api-key', // 如果需要认证
});
async function chatCompletionStream(prompt) {
const stream = await openai.chat.completions.create({
model: 'deepseek-v3', // 你的模型名称
messages: [{ role: 'user', content: prompt }],
stream: true,
});
npm安装和构建
安装:
npm install
如果速度慢,就加上镜像
npm config set registry https://registry.npmmirror.com
再执行一下build:
npm run build
启动服务
最后npm start启动就行了:
npm start
服务启动,访问端口是3000,用浏览器打开3000端口的web网页即可。
从Huggingface源代码开始一点点修改部署到本地
下载Huggingface版本的源代码:
先从网上找到DeepSite的源码,找到了github上的镜像:mutalisk999/deepsite: mirror of https://huggingface.co/spaces/enzostvs/deepsite
将代码git clone到本地:
git clone https://github.com/mutalisk999/deepsite
先安装一下找问题
进入源代码目录,npm安装、构建、启动一键三连!
cd deepsite
npm install
npm run build
npm start
还是那句话,如果速度慢,就加上镜像:
npm config set registry https://registry.npmmirror.com
然后用浏览器登录3000端口,测试项目。
收集问题
这时候项目会调用Huggingface的推理,所以会推理失败,报错:
Error: Error: We have not been able to find inference provider information for model deepseek-ai/DeepSeek-V3-0324.
at getProviderModelId
(file:///home/skywalk/github/deepsite/node_modules/@huggingface/inference/dist/index.js:427:11)
需要修改index.js,修改成使用自定义的llm推理,而不是用Huggingface的推理。
另外还会有报错:you probably reached the MAX_TOKENS limit
这是因为整个系统都跟Huggingface耦合紧密,需要去掉这部分相关耦合代码。
修改代码
根据收集到的问题,在Trae编辑器以及文心大模型的帮助下,修改代码,实现跟Huggingface的解耦,以及自建llm服务器的接入。
最终,修改了三个文件server.js package.json 和package-lock.json:
三个文件跟原文件相比,修改部分如下:
server.js
diff server.js ~/work/deepsite/server.js
185,207d184
< const { hf_token } = req.cookies;
< let token = hf_token;
< const ip =
< req.headers["x-forwarded-for"]?.split(",")[0].trim() ||
< req.headers["x-real-ip"] ||
< req.socket.remoteAddress ||
< req.ip ||
< "0.0.0.0";
<
< if (!hf_token) {
< // Rate limit requests from the same IP address, to prevent abuse, free is limited to 2 requests per IP
< ipAddresses.set(ip, (ipAddresses.get(ip) || 0) + 1);
< if (ipAddresses.get(ip) > MAX_REQUESTS_PER_IP) {
< return res.status(429).send({
< ok: false,
< openLogin: true,
< message: "Log In to continue using the service",
< });
< }
<
< token = process.env.DEFAULT_HF_TOKEN;
< }
<
213d189
< const client = new InferenceClient(token);
217,219c193,194
< const chatCompletion = client.chatCompletionStream({
< model: MODEL_ID,
< provider: "fireworks-ai",
---
> const stream = await openai.chat.completions.create({
> model: 'deepseek-v3', // 你的模型名称
247c222
< max_tokens: 12_000,
---
> stream: true,
250,252c225,231
< while (true) {
< const { done, value } = await chatCompletion.next();
< if (done) {
---
> for await (const chunk of stream) {
> const content = chunk.choices[0]?.delta?.content || '';
> res.write(content);
> completeResponse += content;
>
> // Break when HTML is complete
> if (completeResponse.includes("</html>")) {
255,264d233
< const chunk = value.choices[0]?.delta?.content;
< if (chunk) {
< res.write(chunk);
< completeResponse += chunk;
<
< // Break when HTML is complete
< if (completeResponse.includes("</html>")) {
< break;
< }
< }
271d239
< // If we haven't sent a response yet, send an error
278d245
< // Otherwise end the stream
290a258,287
>
>
> import OpenAI from 'openai';
>
> const openai = new OpenAI({
> baseURL: 'http://192.168.1.5:1337/v1',
> apiKey: 'your-api-key', // 如果需要认证
> });
>
> async function chatCompletionStream(prompt) {
> const stream = await openai.chat.completions.create({
> model: 'deepseek-v3', // 你的模型名称
> messages: [{ role: 'user', content: prompt }],
> stream: true,
> });
>
> for await (const chunk of stream) {
> const content = chunk.choices[0]?.delta?.content || '';
> res.write(content);
> completeResponse += content;
>
> // Break when HTML is complete
> if (completeResponse.includes("</html>")) {
> break;
> }
> }
>
> // End the response stream
> res.end();
> }
package.json
diff package.json ~/work/deepsite/package.json
23a24
> "openai": "^4.91.0",
package-lock.json
diff package-lock.json ~/work/deepsite/package-lock.json
20a21
> "openai": "^4.91.0",
1703a1705,1714
> "node_modules/@types/node-fetch": {
> "version": "2.6.12",
> "resolved": "https://registry.npmmirror.com/@types/node-fetch/-/node-fetch-2.6.12.tgz",
> "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==",
> "license": "MIT",
> "dependencies": {
> "@types/node": "*",
> "form-data": "^4.0.0"
> }
> },
2016a2028,2039
> "node_modules/abort-controller": {
> "version": "3.0.0",
> "resolved": "https://registry.npmmirror.com/abort-controller/-/abort-controller-3.0.0.tgz",
> "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
> "license": "MIT",
> "dependencies": {
> "event-target-shim": "^5.0.0"
> },
> "engines": {
> "node": ">=6.5"
> }
> },
2049a2073,2084
> "node_modules/agentkeepalive": {
> "version": "4.6.0",
> "resolved": "https://registry.npmmirror.com/agentkeepalive/-/agentkeepalive-4.6.0.tgz",
> "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==",
> "license": "MIT",
> "dependencies": {
> "humanize-ms": "^1.2.1"
> },
> "engines": {
> "node": ">= 8.0.0"
> }
> },
2091a2127,2132
> "node_modules/asynckit": {
> "version": "0.4.0",
> "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
> "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
> "license": "MIT"
> },
2500a2542,2553
> "node_modules/combined-stream": {
> "version": "1.0.8",
> "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
> "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
> "license": "MIT",
> "dependencies": {
> "delayed-stream": "~1.0.0"
> },
> "engines": {
> "node": ">= 0.8"
> }
> },
2676a2730,2738
> "node_modules/delayed-stream": {
> "version": "1.0.0",
> "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
> "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
> "license": "MIT",
> "engines": {
> "node": ">=0.4.0"
> }
> },
2819a2882,2896
> "node_modules/es-set-tostringtag": {
> "version": "2.1.0",
> "resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
> "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
> "license": "MIT",
> "dependencies": {
> "es-errors": "^1.3.0",
> "get-intrinsic": "^1.2.6",
> "has-tostringtag": "^1.0.2",
> "hasown": "^2.0.2"
> },
> "engines": {
> "node": ">= 0.4"
> }
> },
3069a3147,3155
> "node_modules/event-target-shim": {
> "version": "5.0.1",
> "resolved": "https://registry.npmmirror.com/event-target-shim/-/event-target-shim-5.0.1.tgz",
> "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
> "license": "MIT",
> "engines": {
> "node": ">=6"
> }
> },
3303a3390,3423
> "node_modules/form-data": {
> "version": "4.0.2",
> "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.2.tgz",
> "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
> "license": "MIT",
> "dependencies": {
> "asynckit": "^0.4.0",
> "combined-stream": "^1.0.8",
> "es-set-tostringtag": "^2.1.0",
> "mime-types": "^2.1.12"
> },
> "engines": {
> "node": ">= 6"
> }
> },
> "node_modules/form-data-encoder": {
> "version": "1.7.2",
> "resolved": "https://registry.npmmirror.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz",
> "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==",
> "license": "MIT"
> },
> "node_modules/formdata-node": {
> "version": "4.4.1",
> "resolved": "https://registry.npmmirror.com/formdata-node/-/formdata-node-4.4.1.tgz",
> "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==",
> "license": "MIT",
> "dependencies": {
> "node-domexception": "1.0.0",
> "web-streams-polyfill": "4.0.0-beta.3"
> },
> "engines": {
> "node": ">= 12.20"
> }
> },
3465a3586,3600
> "node_modules/has-tostringtag": {
> "version": "1.0.2",
> "resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
> "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
> "license": "MIT",
> "dependencies": {
> "has-symbols": "^1.0.3"
> },
> "engines": {
> "node": ">= 0.4"
> },
> "funding": {
> "url": "https://github.com/sponsors/ljharb"
> }
> },
3538a3674,3682
> "node_modules/humanize-ms": {
> "version": "1.2.1",
> "resolved": "https://registry.npmmirror.com/humanize-ms/-/humanize-ms-1.2.1.tgz",
> "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
> "license": "MIT",
> "dependencies": {
> "ms": "^2.0.0"
> }
> },
4870a5015,5053
> "node_modules/node-domexception": {
> "version": "1.0.0",
> "resolved": "https://registry.npmmirror.com/node-domexception/-/node-domexception-1.0.0.tgz",
> "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
> "funding": [
> {
> "type": "github",
> "url": "https://github.com/sponsors/jimmywarting"
> },
> {
> "type": "github",
> "url": "https://paypal.me/jimmywarting"
> }
> ],
> "license": "MIT",
> "engines": {
> "node": ">=10.5.0"
> }
> },
> "node_modules/node-fetch": {
> "version": "2.7.0",
> "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.7.0.tgz",
> "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
> "license": "MIT",
> "dependencies": {
> "whatwg-url": "^5.0.0"
> },
> "engines": {
> "node": "4.x || >=6.0.0"
> },
> "peerDependencies": {
> "encoding": "^0.1.0"
> },
> "peerDependenciesMeta": {
> "encoding": {
> "optional": true
> }
> }
> },
4946a5130,5174
> "node_modules/openai": {
> "version": "4.91.0",
> "resolved": "https://registry.npmmirror.com/openai/-/openai-4.91.0.tgz",
> "integrity": "sha512-zdDg6eyvUmCP58QAW7/aPb+XdeavJ51pK6AcwZOWG5QNSLIovVz0XonRL9vARGJRmw8iImmvf2A31Q7hoh544w==",
> "license": "Apache-2.0",
> "dependencies": {
> "@types/node": "^18.11.18",
> "@types/node-fetch": "^2.6.4",
> "abort-controller": "^3.0.0",
> "agentkeepalive": "^4.2.1",
> "form-data-encoder": "1.7.2",
> "formdata-node": "^4.3.2",
> "node-fetch": "^2.6.7"
> },
> "bin": {
> "openai": "bin/cli"
> },
> "peerDependencies": {
> "ws": "^8.18.0",
> "zod": "^3.23.8"
> },
> "peerDependenciesMeta": {
> "ws": {
> "optional": true
> },
> "zod": {
> "optional": true
> }
> }
> },
> "node_modules/openai/node_modules/@types/node": {
> "version": "18.19.85",
> "resolved": "https://registry.npmmirror.com/@types/node/-/node-18.19.85.tgz",
> "integrity": "sha512-61sLB7tXUMpkHJagZQAzPV4xGyqzulLvphe0lquRX80rZG24VupRv9p6Qo06V9VBNeGBM8Sv8rRVVLji6pi7QQ==",
> "license": "MIT",
> "dependencies": {
> "undici-types": "~5.26.4"
> }
> },
> "node_modules/openai/node_modules/undici-types": {
> "version": "5.26.5",
> "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz",
> "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
> "license": "MIT"
> },
6085a6314,6319
> "node_modules/tr46": {
> "version": "0.0.3",
> "resolved": "https://registry.npmmirror.com/tr46/-/tr46-0.0.3.tgz",
> "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
> "license": "MIT"
> },
6443a6678,6702
> }
> },
> "node_modules/web-streams-polyfill": {
> "version": "4.0.0-beta.3",
> "resolved": "https://registry.npmmirror.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz",
> "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==",
> "license": "MIT",
> "engines": {
> "node": ">= 14"
> }
> },
> "node_modules/webidl-conversions": {
> "version": "3.0.1",
> "resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
> "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
> "license": "BSD-2-Clause"
> },
> "node_modules/whatwg-url": {
> "version": "5.0.0",
> "resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-5.0.0.tgz",
> "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
> "license": "MIT",
> "dependencies": {
> "tr46": "~0.0.3",
> "webidl-conversions": "^3.0.0"
喜欢动手的朋友,可以尝试一下手工修改代码。
时间紧张,只是想尝试一下DeepSite的朋友,直接用上面的最简单操作即可。
测试
安装完成后,可以用这个prompt试试:
帮我建一个类似“雷电”打飞机的游戏页面,使用html5,飞机可以左右移动,用左右方向键移动。景物和障碍从上向下滚动。按空格键发射子弹,子弹击中障碍物后,障碍物消失,并得10分。点击“开始游戏”开始,得分达到100分通关,输出“恭喜通关!”
感觉效果比Huggingface官网的要差一点点,不过不用科学上网,要啥自行车呢。
DeepSite最大的特点就是所见即所得,其实写代码,直接用Deepseek-v3或者Deepseek-r1都可以,但是需要再手工把代码copy出来。DeepSite没有中间商赚差价,用起来确实爽!
欢迎大家一键三连!并请帮我的github项目点个小星星哦!
项目地址:https://github.com/skywalk163/deepsite
调试
如果有报错说缺少openai库,那么npm install openai即可。
创建游戏后点击开始却没有开始
继续在对话框输入“点击开始进行开始”