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

可以部署在cf上吗? #13

Closed
SokWith opened this issue Jul 29, 2023 · 19 comments
Closed

可以部署在cf上吗? #13

SokWith opened this issue Jul 29, 2023 · 19 comments
Labels
wontfix This will not be worked on

Comments

@SokWith
Copy link

SokWith commented Jul 29, 2023

这个项目与NewBingGoGo-Web的实现原理有什么差异吗?
是重写前端,调用可代理访问官网的后端服务器来实现的吧?
目前NBGoGo的前端是放在github上,后端直接用的cf的workes,可以很好工作。
但由于作者没有精力跟进前端功能开发,项目基本停摆了。

这个项目原理基本相似,应该也可以直接在cf上部署后端,github上部署前端吧?

@weaigc
Copy link
Owner

weaigc commented Jul 29, 2023

这个项目与NewBingGoGo-Web的实现原理有什么差异吗? 是重写前端,调用可代理访问官网的后端服务器来实现的吧? 目前NBGoGo的前端是放在github上,后端直接用的cf的workes,可以很好工作。 但由于作者没有精力跟进前端功能开发,项目基本停摆了。

这个项目原理基本相似,应该也可以直接在cf上部署后端,github上部署前端吧?
@SokWith
我先把todo搞完,cf考虑到有被封锁,可能要看一下还存在哪些问题。hf也是免费的呀,不考虑吗

weaigc added a commit that referenced this issue Jul 31, 2023
weaigc added a commit that referenced this issue Jul 31, 2023
@weaigc weaigc added the enhancement New feature or request label Jul 31, 2023
weaigc added a commit that referenced this issue Aug 2, 2023
@weaigc
Copy link
Owner

weaigc commented Aug 2, 2023

@SokWith 考虑到封锁原因,不考虑支持直接支持 workers,不过已支持 cloudflare workers 域名转发,README.md 有更新,你可以试试。

@SokWith
Copy link
Author

SokWith commented Aug 3, 2023

@SokWith 考虑到封锁原因,不考虑支持直接支持 workers,不过已支持 cloudflare workers 域名转发,README.md 有更新,你可以试试。

谢谢。

@SokWith
Copy link
Author

SokWith commented Aug 15, 2023

作者,你好。
能不能把你这个项目 如何获取 https://www.bing.com/turing/conversation/create 的返回头文件/cookie 的代码用 cf的workers来实现,或者能不能解释一下代码是如何处理的流程图?就是要如何创建哪些头文件项目后去fetch官方的这个网址以获得聊天句柄?
我发现你这个项目确实不需要cookie就可以默认展开聊天,头文件的创建方式似乎有所不同

请见谅我没有多少代码能力,只能拿来主义

Harry-zklcdc/go-proxy-bingai#138 (comment)

@weaigc weaigc closed this as completed Aug 16, 2023
@weaigc weaigc reopened this Aug 16, 2023
@weaigc
Copy link
Owner

weaigc commented Aug 16, 2023

作者,你好。 能不能把你这个项目 如何获取 https://www.bing.com/turing/conversation/create 的返回头文件/cookie 的代码用 cf的workers来实现,或者能不能解释一下代码是如何处理的流程图?就是要如何创建哪些头文件项目后去fetch官方的这个网址以获得聊天句柄? 我发现你这个项目确实不需要cookie就可以默认展开聊天,头文件的创建方式似乎有所不同

请见谅我没有多少代码能力,只能拿来主义

Harry-zklcdc/go-proxy-bingai#138 (comment)
@SokWith 我这边的原理是: /api/create 转发请求到 https://www.bing.com/turing/conversation/create ,这就需要转发的服务部署在美国机房,如 HF 上。

@SokWith
Copy link
Author

SokWith commented Aug 17, 2023

@weaigc
Copy link
Owner

weaigc commented Aug 18, 2023

@SokWith 我明白你的意思了,这个我后面加了个 workers 脚本吧,先标记一下。

@weaigc weaigc closed this as completed Aug 18, 2023
@weaigc
Copy link
Owner

weaigc commented Aug 20, 2023

@SokWith 封锁升级了,cf workers 就算部署了目前也没有办法正常使用,计划暂时只能取消。

@weaigc weaigc added wontfix This will not be worked on and removed enhancement New feature or request labels Aug 20, 2023
@SokWith
Copy link
Author

SokWith commented Aug 21, 2023

好的,谢谢

@weaigc
Copy link
Owner

weaigc commented Aug 22, 2023

@SokWith
Copy link
Author

SokWith commented Aug 22, 2023

@SokWith 这个是 proxy 代码 https://github.com/weaigc/bingo/blob/feature/cf-proxy/cloudflare/proxy.js

谢谢。我粗略理解这个是聊天的代理吧?需要配合前端来工作的吧?
bing这个项目,现在根本的问题是如何create一个有效的conversationId吧,目前隔壁代理情况看,只有转发成微软的IP才管用了。

@SokWith
Copy link
Author

SokWith commented Nov 11, 2023

@weaigc 大佬,你那个cf workers上的proxy.js是不是可以做WS_ENDPOINT用?能不能再改写一个可以部署在其它平台的代码,专门用作WS_ENDPOINT服务器以应对官方对WSS服务器的封控?主要是cf 上的WS_ENDPOINT不能匿名访问的。

@weaigc
Copy link
Owner

weaigc commented Nov 11, 2023

@weaigc 大佬,你那个cf workers上的proxy.js是不是可以做WS_ENDPOINT用?能不能再改写一个可以部署在其它平台的代码,专门用作WS_ENDPOINT服务器以应对官方对WSS服务器的封控?主要是cf 上的WS_ENDPOINT不能匿名访问的。
@SokWith
其实可以部署在任意平台,你可以看一下这个 https://github.com/weaigc/bingo/blob/532df35440f4e99b38f136c54db9400dd4bdddd6/cloudflare/worker.js

@SokWith
Copy link
Author

SokWith commented Nov 12, 2023

谢谢。只是不是很明白,里面的TARGET_HOST后台服务器是只提供前端界面吗?看代码里面似乎有wss转发那就用不上TARGET_HOST后台服务器做wss转发吧?

另外,cf workers的代码不是标准node.js代码吧?不能直接用在其他平台上吧?

@weaigc
Copy link
Owner

weaigc commented Nov 12, 2023

谢谢。只是不是很明白,里面的TARGET_HOST后台服务器是只提供前端界面吗?看代码里面似乎有wss转发那就用不上TARGET_HOST后台服务器做wss转发吧?

另外,cf workers的代码不是标准node.js代码吧?不能直接用在其他平台上吧?

可以用 cli.js 启动

@SokWith
Copy link
Author

SokWith commented Nov 15, 2023

谢谢。只是不是很明白,里面的TARGET_HOST后台服务器是只提供前端界面吗?看代码里面似乎有wss转发那就用不上TARGET_HOST后台服务器做wss转发吧?
另外,cf workers的代码不是标准node.js代码吧?不能直接用在其他平台上吧?

可以用 cli.js 启动

谢谢。折腾了许久才发现cli是虚拟加载到了本地网络,与期望的远程部署完全相反,不能作为WSS节点使用。

@weaigc
Copy link
Owner

weaigc commented Nov 20, 2023

谢谢。只是不是很明白,里面的TARGET_HOST后台服务器是只提供前端界面吗?看代码里面似乎有wss转发那就用不上TARGET_HOST后台服务器做wss转发吧?
另外,cf workers的代码不是标准node.js代码吧?不能直接用在其他平台上吧?

可以用 cli.js 启动

谢谢。折腾了许久才发现cli是虚拟加载到了本地网络,与期望的远程部署完全相反,不能作为WSS节点使用。

你部署在哪就可以使用哪里的网络

@SokWith
Copy link
Author

SokWith commented Nov 20, 2023

谢谢。只是不是很明白,里面的TARGET_HOST后台服务器是只提供前端界面吗?看代码里面似乎有wss转发那就用不上TARGET_HOST后台服务器做wss转发吧?
另外,cf workers的代码不是标准node.js代码吧?不能直接用在其他平台上吧?

可以用 cli.js 启动

谢谢。折腾了许久才发现cli是虚拟加载到了本地网络,与期望的远程部署完全相反,不能作为WSS节点使用。

你部署在哪就可以使用哪里的网络

部署的是上面你那个有WSS转发的worker.js哟,不是main下的全站转发的js代码,后者只是反代而已,前者是相当于部署wss代理服务器。但我在多个云商里面cli处理出来的都是变成了本地网络访问官服造成失败。不过后来我问了一下bing,让它给了我一份node.js的代码,部署在render和huggingface上都ok的。

const httpProxy = require('http-proxy');
const proxy = httpProxy.createProxyServer({});

proxy.on('proxyReq', function(proxyReq, req, res, options) {
  proxyReq.setHeader('Origin', 'https://www.bing.com');
});

const serverUrl = 'sydney.bing.com';

const server = require('http').createServer(function(req, res) {
  proxy.web(req, res, {
    target: 'wss://' + serverUrl,
    ws: true,
    changeOrigin: true
  });
});

server.on('upgrade', function(req, socket, head) {
  proxy.ws(req, socket, head, {
    target: 'wss://' + serverUrl,
    changeOrigin: true
  });
});

server.listen(7860);

@weaigc
Copy link
Owner

weaigc commented Nov 22, 2023

谢谢。只是不是很明白,里面的TARGET_HOST后台服务器是只提供前端界面吗?看代码里面似乎有wss转发那就用不上TARGET_HOST后台服务器做wss转发吧?
另外,cf workers的代码不是标准node.js代码吧?不能直接用在其他平台上吧?

可以用 cli.js 启动

谢谢。折腾了许久才发现cli是虚拟加载到了本地网络,与期望的远程部署完全相反,不能作为WSS节点使用。

你部署在哪就可以使用哪里的网络

部署的是上面你那个有WSS转发的worker.js哟,不是main下的全站转发的js代码,后者只是反代而已,前者是相当于部署wss代理服务器。但我在多个云商里面cli处理出来的都是变成了本地网络访问官服造成失败。不过后来我问了一下bing,让它给了我一份node.js的代码,部署在render和huggingface上都ok的。

const httpProxy = require('http-proxy');
const proxy = httpProxy.createProxyServer({});

proxy.on('proxyReq', function(proxyReq, req, res, options) {
  proxyReq.setHeader('Origin', 'https://www.bing.com');
});

const serverUrl = 'sydney.bing.com';

const server = require('http').createServer(function(req, res) {
  proxy.web(req, res, {
    target: 'wss://' + serverUrl,
    ws: true,
    changeOrigin: true
  });
});

server.on('upgrade', function(req, socket, head) {
  proxy.ws(req, socket, head, {
    target: 'wss://' + serverUrl,
    changeOrigin: true
  });
});

server.listen(7860);

原理一样的,之所以后面取消这个功能是因为 cf,replit,还有deno都被微软封锁了,留着没多大意义就下了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants