Giter Club home page Giter Club logo

chatgpt-web's Issues

谢谢大佬,有个问题,就是不支持不是以SW开头的密钥

我用的是微软的azure的endpoint,并使用cloudflare的works转换为类openai的请求,但是输入的密钥不是sw开头的密钥,类似:35ksdifusuqwqweqwfdrg353eqwefs这样的KEY,但是你的这个系统不支持, 我用chtgpt next web等其它几个webui都能正常使用。你做得很好,麻烦看看是哪里问题。

提示:API密钥错误或失效,请检查API密钥!

利用socat出现ssl握手错误

nginx配置文件

	location ^~ /v1 {
		proxy_pass https://127.0.0.1:8443;
		proxy_set_header Host api.openai.com;
		proxy_set_header  Authorization "Bearer sk-xxx";
		proxy_pass_header Authorization;
		proxy_buffering off;
	}
	
	location / {
		root /usr/share/nginx/html;
		index index.html;
	}

Nginx错误日志
2023/03/30 16:03:55 [error] 17244#17244: *2 SSL_do_handshake() failed (SSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure) while SSL handshaking to upstream, client: 10.167.237.172, server: , request: "POST /v1/chat/completions HTTP/1.1", upstream: "https://127.0.0.1:8443/v1/chat/completions", host: "10.167.237.118", referrer: "http://10.167.237.118/"

有大佬知道解决方案吗?

加一个滑动功能

点击右上角菜单弹出的那段代码块,如果加一个上下滑动功能就更完美了,可以适配手机和一些小屏的笔记本。我的13.3英寸的笔记本要通过缩放屏幕比例才能看得到底部的菜单选项

Possible to use Davinci

Hello friends. I would like to use your chatgpt-web for some classroom experiments.

Is it possible to support text-davinci-003?

Very nice project you have. Sorry I do not speak your language, please forgive my question in english.

Cheers!

help me plz

2023/03/31 15:53:01 [error] 724#4800: *65 SSL_do_handshake() failed (SSL: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:SSL alert number 40) while SSL handshaking to upstream, client: 2.58.65.58, server: localhost, request: "POST /v1/chat/completions HTTP/1.1", upstream: "https://104.18.7.192:443/v1/chat/completions", host: "保密", referrer: "保密"

增加一个“stop response”

大佬,可不可以增加一个“暂停”的按钮。比如在”发送“按钮那里,点击”发送“后,就会显示”暂停“,点enter以后,就会暂停输出。因为有时候输出的是自己不想要的内容,又不想浪费key的时候,这个就非常关键。
还有可不可以再加一个可以一键把整个会话加载成一个图片"导出图片“的功能。
如果可能的话,能不能实现"New chat", 能多窗口会话!

手机端左侧顶部的新建会话选项有bug

经常点击了没反应,偶尔有一次点开后不能返回主界面

还有三个小建议:
1、发送的内容都被压缩成一行了,特别是我要让它优化代码,太不好看了,希望能像官方那种保留发送内容格式。
2、有了"新建会话"选项感觉没必要在“发送”按钮边边存在“清空会话”,因为在手机端容易点到,太挤。或者修改为电脑端显示,手机端隐藏。
3、右侧选项是不是可以增加一个“恢复默认配置“

按文档中的把API KEY输入,但是还是报API KEY错误

{
"error": {
"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
已经按文档中的把API KEY输入,但是还是报API KEY错误,请问这个要如何解决?
Snipaste_2023-03-09_08-45-03

有没有更多的部署方案

比如说 vercel 部署 密钥放到环境变量里。
或者宝塔部署,如何配置。
或者docker部署
几个我都试了,只能前端输入自定义的KEY, nginx的配置文件加入KEY,都不成功。

basic_auth一开启就报错

大佬,配置了下面的东西后,Nginx的basic_auth一开启就报错

map $http_authorization $gptauth {
    default  $http_authorization;
    ""       "Bearer sb-your-token"; #这里改了
}
server {
    listen       80;
    server_name  example.com;
    gzip  on;
    gzip_min_length 1k;
    gzip_types text/event-stream;

    location ^~ /v1 {
        proxy_pass https://api.openai-sb.com/v1;   #这里改了
        proxy_set_header Host api.openai-sb.com;   #这里改了
        proxy_ssl_name api.openai-sb.com;   #这里改了
        proxy_ssl_server_name on;
        proxy_set_header Authorization $gptauth;
        proxy_pass_header Authorization;
        proxy_buffering off;
    }

    location / {
        alias /usr/share/nginx/html/;
        index index.html;
    }
}

开启basic_auth后,网页上提示API密钥错误或失效,请检查API密钥!
关掉basic_auth就又正常了

另外,我用的是别人代理的api,需要把nginx配置里的代理地址、请求头之类从api.openai.com改成api.openai-sb.com,还要把sk-开头的密钥改成了sb-开头的密钥。这没影响吧?

主要是关闭basic_auth就一切都正常。

大佬,请问一下如何加密码?

大佬,我搭建在公网上,不想被人随便访问,只共享给几个朋友用,给他们api_key密钥对于他们太麻烦,网上找了些代码,感觉都太简陋了(我很小白,只会复制粘贴,但还是觉得那些方法只拦得住我这样的小白T.T),不保险。

请问有什么方法可以让访问者输入设定好的密码再使用呢?

再麻烦问一下大佬,api key要怎样加到html文件里去呀?(就是不再需要访客输入api_key)我搞不太明白。

关于tokens的统计

感谢如此精致简洁的代码。感觉所有stream形式都不方便统计tokens,后来看了下官方文档。数据流返回是按1个token返回的,也就是每一个data都是占用1个token。
那么不知道大佬能否加上输出完整之后的data数累加,这样可以作为消耗的tokens来计算。

点击复制bug

点击复制内容时候,会复制不完整。
比如gpt给了下面代码:

import re

def send_html(html):
    # 在所有的html标签中添加一个唯一的标记
    html = re.sub(r'<(/?[a-z]+)>', r'{{\1}}', html)
    # 分段处理html
    while len(html) > 2000:
        # 将前2000个字放入一段中
        text = html[:2000]
        # 如果该段的末尾有标签,则将该标签后的内容移动到下一段
        match = re.search(r'{{/?[a-z]+}}$', text)
        if match:
            last_tag = match.group()
            text = text[:match.start()]
            html = last_tag + html[2000:]
        else:
            html = html[2000:]
        # 发送该段
        send(text)
    # 发送剩余的内容
    send(html)

点击复制后会变成这个:


import re

def send_html(html):
    # 在所有的html标签中添加一个唯一的标记
    html = re.sub(r'<(/?[a-z]+)>', r'{{\1}}', html)
    # 分段处理html
    while len(html) > 2000:
        # 将前2000个字放入一段中
        text = html[:2000]
        # 如果该段的末尾有标签,则将该标签后的内容移动到下一段
        match = re.search(r'{{/?[a-z]+}}
, text)
        if match:
            last_tag = match.group()
            text = text[:match.start()]
            html = last_tag + html[2000:]
        else:
            html = html[2000:]
        # 发送该段
        send(text)
    # 发送剩余的内容
    send(html)

漏掉了 $'

html代码无法正常显示

首先,代码框里是正常显示:

&nbsp; #这是一串代码

然后,markdown语法也正常显示:&nbsp;

但要是回答中出现无格式的:&nbsp;

就直接是个空格:

看前面的issues,是不是没有太好的解决办法呀?

最后,忍不住赞一下,大佬代码的可读性真的超级高,让我这个小白都能试着动手改一改:)

windows server 2016,执行exe报错

windows server 2016版,英文系统
语句中有中文字符?

错误如下:

2023/04/06 13:50:10 �[32m/go/pkg/mod/github.com/glebarez/[email protected]/migrator.go:310
�[0m�[33m[0.000ms] �[34;1m[rows:-]�[0m SELECT count(*) FROM sqlite_master WHERE type = "index" AND tbl_name = "users" AND name = "idx_users_updated_at"
2023/04/06 13:50:10 decode config err: invalid character 'ï' looking for beginning of value

在Linux服务器上运行,发送对话提示“无权使用此模型,请打开设置选择其他GPT模型!“

问题描述:
在香港linux服务器上配置,希望可以达到不通过魔法也能够使用的网页,并且设置了网页认证。但是遇到了错误“无权使用此模型,请打开设置选择其他GPT模型!“

我的操作:
将repo的index网页上传到服务器nginx对应的html目录下。通过example.com(域名)可以正常访问。
在example.com网页右边的接口那里从‘https://api.openai.com/‘改为’https://example.com/v1‘以使用nginx反向代理的接口。
发送对话后提示“无权使用此模型,请打开设置选择其他GPT模型!“

最后还有个小问题:这样配置不是任何人访问这个https://example.com/v1都可以使用我的key?那第一个网页设置认证的意义也就不大了吧哈哈哈。有没有解决方案呢,不太懂这方面的内容。

配置nginx代理location为example.com/v1。
nginx配置的location如下:
location ^~ /v1 {
proxy_pass https://api.openai.com/v1;
proxy_set_header Host api.openai.com;
proxy_ssl_name api.openai.com;
proxy_ssl_server_name on;
#注意Bearer 后改为正确的token。如需用户自定义API key,可注释掉下一行
proxy_set_header Authorization "Bearer sk-ABCDEFGbalbalbala(我在openaiapi网页获取的api key)";
proxy_pass_header Authorization;
#流式传输,不关闭buffering缓存会卡顿卡死,必须配置!!!
proxy_buffering off;
}
location / {
gzip on;
gzip_min_length 1k;
gzip_types text/event-stream;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;

}

希望支持页面自定义API HOST

这个项目很赞

如果可以把反代的设置也放在API Key的上方就更好了,这样连Nginx都省了,只需要一个最普通的HTTP Server就可以了

请教如何拆分流式数据

一般接口返回的数据式这样子的
`data: {"id":"chatcmpl-74nY49RucRFv2IE0csGi5svtMQpAF","object":"chat.completion.chunk","created":1681378132,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"role":"assistant"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-74nY49RucRFv2IE0csGi5svtMQpAF","object":"chat.completion.chunk","created":1681378132,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"你"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-74nY49RucRFv2IE0csGi5svtMQpAF","object":"chat.completion.chunk","created":1681378132,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"好"},"index":0,"finish_reason":null}]}`

我阅读您的代码,发现您使用 value.split(/\n{2}/g) 来拆分每一组数据,后续的代码我不太理解,我想知道如果content中包含了
\n\n 您程序是如何处理的?

非常感谢

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.