GithubHelp home page GithubHelp logo

xuelainiao / js-edgegpt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kuaizr/js-edgegpt

0.0 0.0 0.0 504 KB

javascript实现的edgegpt接口,受到KeJunMao/edgegpt和acheong08/EdgeGPT的启发

JavaScript 100.00%

js-edgegpt's Introduction

js-edgegpt

javascript实现的edgegpt接口,

代码参考了KeJunMao/edgegpt和acheong08/EdgeGPT这两个仓库

其实就两步,第一带上自己的cookie(_U字段)去下面这几个网站中的任意一个请求一个conversation

"https://www.bing.com/turing/conversation/create"
"https://cn.bing.com/turing/conversation/create"
"https://edgeservices.bing.com/edgesvc/turing/conversation/create"

这里我测试过了,cn.bing.com也是可以请求到的

然后带着这个conversation去和"wss://sydney.bing.com/sydney/ChatHub"建立一个websocket就可以通过websocket和edgegpt交流了。

在国内也是可以使用的,只是我没有找到模拟微软账号登录拿到cookie的方法

使用

//cookie.js
export const cookie_U = ""

把cookie.js中的cookie_U换成自己的就可以跑了

import { ChatBot } from "./js-edgegpt.js";
let chatbot = new ChatBot(mode);

let res = await chatbot.askAsync("你好");
console.log(res)

或者

import { ChatBot } from "./js-edgegpt.js";
let chatbot = new ChatBot(mode);

let index = 0
await chatbot.ask(prompt, (res) => {
    process.stdout.write(res.substring(index)); // 异步返回的结果需要处理一下
    index = res.length
});
index = 0
process.stdout.write("\n");

mode参数可选三种,对应了目前sydney的三种模式,默认是"h3precise"

"h3precise" -- 准确模式 "h3imaginative" -- 创造模式 "harmonyv3" -- 均衡模式

预览

预览

js-edgegpt's People

Contributors

kuaizr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.