KendoCross / newbing

new bing API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

newbing

new bing API

new bing chat

    import "github.com/KendoCross/newbing"
    
    // 通过 cookie 初始化
    bingChat, err := newbing.NewChat(" new bing cookie ")
    if err != nil {
        t.Error(err)
        return
    }
    // 发起聊天
    ans, err := bingChat.Chat(context.TODO(), "你是chatGPT吗?")
    if err != nil {
        t.Error(err)
        return
    }
    println(ans)

    ans, err = bingChat.Chat(context.TODO(), "你能做什么?")
    if err != nil {
        t.Error(err)
        return
    }
    println(ans)
    

new bing image generation

    import "github.com/KendoCross/newbing"
    
    bingImgGen := newbing.NewImgGen("new bing cookie")
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    imgURLsCh, err := bingImgGen.GenImgAync(ctx, "功夫熊猫")
    if err != nil {
        t.Error(err)
        return
    }

    imgURLs := <-imgURLsCh
    for _, url := range imgURLs {
        println(url)
    }
    

About

new bing API

License:Apache License 2.0


Languages

Language:Go 100.0%