Giter Club home page Giter Club logo

chatgpt's Introduction

中文 | English

chatgpt

构建你的 OpenAI ChatGPT Web 站点

语音识别功能,默认使用本地语音识别模式,当本地语音识别失败,会自动使用 OpenAI Whisper 开始识别,也可以设置为 仅使用 Wishper 进行识别。

注:由于 Android 手机用户无法同时进行本地语音识别和录音服务(和 Android 系统特性有关),所以手机用户请开启 仅使用 Wishper 模式。

  • 自定义 OpenAI 域名,直连,不经过他人服务器,无需担心 Key 泄露;
  • 自己的 API Key;
  • 所有数据都在本地存储;
  • 模型选择;
  • 可设置助手 prompt
  • 预置多个 prompt
  • 会话历史记录(本地存储);
  • 支持设置 temperature 参数;
  • 支持 sse,即 openai api 中的 stream
  • 支持自动播放文本(TTS);
  • 支持语音录入(ASR)。
  • 支持 OpenAI Whisper 识别(默认使用本地语音识别)

欢迎更多人来完善这个 prompt list

部署

Fork 此项目,然后开启你的 GitHub Pages 即可。

如果你的 OpenAI 不可访问,可以尝试使用这个方案:使用 Cloudflare Workers 让 OpenAI API 绕过 GFW 且避免被封禁

省流版:创建一个 Cloudflare Workers,编写内容并发布:

Worker JS

其中 <your openai api key> 填写你的 OpenAI api key 即可实现客户端无 key 使用。

addEventListener('fetch', event => {
    event.respondWith(fetchAndApply(event.request));
})

async function fetchAndApply(request) {

    let response = null;
    let method = request.method;

    let url = new URL(request.url);
    let url_hostname = url.hostname;
    url.protocol = 'https:';
    url.host = 'api.openai.com';

    let request_headers = request.headers;
    let new_request_headers = new Headers(request_headers);
    new_request_headers.set('Host', url.host);
    new_request_headers.set('Referer', url.protocol + '//' + url_hostname);
    new_request_headers.set('Authorization', 'Bearer <your openai api key>');

    let original_response = await fetch(url.href, {
        method: method,
        headers: new_request_headers,
        body: request.body
    })

    // let original_response_clone = original_response.clone();
    let original_text = null;
    let response_headers = original_response.headers;
    let new_response_headers = new Headers(response_headers);
    let status = original_response.status;

    new_response_headers.set('Cache-Control', 'no-store');
    new_response_headers.set('access-control-allow-origin', '*');
    new_response_headers.set('access-control-allow-credentials', true);
    new_response_headers.delete('content-security-policy');
    new_response_headers.delete('content-security-policy-report-only');
    new_response_headers.delete('clear-site-data');

    original_text = original_response.body
    response = new Response(original_text, {
        status,
        headers: new_response_headers
    })

    return response
}

async function replace_response_text(response, upstream_domain, host_name) {
    let text = await response.text()

    var i, j;
    for (i in replace_dict) {
        j = replace_dict[i]
        if (i == '$upstream') {
            i = upstream_domain
        } else if (i == '$custom_domain') {
            i = host_name
        }

        if (j == '$upstream') {
            j = upstream_domain
        } else if (j == '$custom_domain') {
            j = host_name
        }

        let re = new RegExp(i, 'g')
        text = text.replace(re, j);
    }
    return text;
}

chatgpt's People

Contributors

excing avatar yaner-here avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chatgpt's Issues

使用新版本(2023-09-01-preview)出现了TypeError: Cannot read properties of undefined (reading 'delta')

app.js:161 TypeError: Cannot read properties of undefined (reading 'delta')
at app.js:120:31
at app.js:192:11
at sse.js:77:9
at Array.every ()
at SSE.dispatchEvent (sse.js:76:37)
at SSE. (sse.js:123:14)
at Array.forEach ()
at SSE._onStreamProgress (sse.js:121:36)
onError @ app.js:161
(匿名) @ app.js:194
(匿名) @ sse.js:77
SSE.dispatchEvent @ sse.js:76
(匿名) @ sse.js:123
SSE._onStreamProgress @ sse.js:121
XMLHttpRequest.send(异步)
SSE.stream @ sse.js:200
send @ app.js:203
chat @ app.js:113
postLine @ app.js:99
onSend @ app.js:69
(匿名) @ app.js:47

支持下GPT-4?

大佬,添加下GPT-4的模型?
话说非Plus的API是不是用不了GPT-4

请适配一下渐进式 Web 应用(PWA)

https://sspai.com/post/65869

PWA(Progressive Web Apps,渐进式 Web 应用)运用现代的 Web API 以及传统的渐进式增强策略来创建跨平台 Web 应用程序。这些应用无处不在、功能丰富,使其具有与原生应用相同的用户体验优势。这组文档和指南告诉您有关 PWA 的所有信息。

PWA 的优势
PWA 是可被发现、易安装、可链接、独立于网络、渐进式、可重用、响应性和安全的。关于这些含义的细节,请参阅 PWA 的优势 (en-US)。关于如何实施 PWA,请参阅下面列出的指南。

用了一段时间后的一些需求

1.想要能一键删除历史记录,我现在历史记录太多已经要等两秒才能点开了。
2.历史记录里过去的对话很难找,希望能把特定的对话命个名单独收藏起来。
3.历史记录里的文字如果有HTML会被可视化。
4.聊了很长之后要开新的对话要翻很长到页面最上,希望能优化一下UI.

I hope this message finds you well.

Dear excing

I hope this message finds you well. I am reaching out to discuss some potential security concerns related to your GitHub repository [repository name].

While reviewing your code, I noticed that it incorporates some interesting uses of speech recognition and transcription, utilizing both the Web Speech API and the Whisper API. However, there are some aspects related to security and privacy that could benefit from further consideration:

Secure handling of API keys: Your code involves the use of an API key for the Whisper API. It's crucial to ensure that this key is stored and used securely. API keys should never be stored in plain text or made public in any way. Consider using environment variables or secure key management systems.

User privacy: Your application records audio from the user's microphone. Please ensure that you are handling these recordings in a way that respects user privacy and complies with relevant data protection regulations. Users should be informed about how their data is being used and stored, and they should have the ability to control this.

Web application security: Consider implementing protection against common web security threats such as Cross-Site Scripting (XSS) and SQL Injection.

I strongly recommend reviewing OpenAI's best practices for implementing AI systems, which provide valuable guidance on security, privacy, and ethical considerations. It's important to consider these aspects not only in the development stage but also when deploying and maintaining your application.

Please understand that this message is meant to be helpful and constructive. The aim is to help you build a more secure and privacy-conscious application.

Best regards,

Volkan Sah
other usefull links for you:
https://github.com/VolkanSah/Implementing-AI-Systems-Whitepaper
https://github.com/VolkanSah/ChatGPT-Security-Best-Practices
cause i found your script on a community site i look for it

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.