Giter Site home page Giter Site logo

ilyydy / cf-openai Goto Github PK

View Code? Open in Web Editor NEW
33.0 2.0 13.0 490 KB

Deploy your chatGPT service on Cloudflare Workers and integrate with apps.

License: MIT License

Shell 0.88% TypeScript 98.69% JavaScript 0.42%
chatgpt cloudflare-workers openai-api wechat azure-openai cloudflare wework

cf-openai's People

Contributors

7hens avatar ilyydy avatar renovate[bot] 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

Watchers

 avatar  avatar

cf-openai's Issues

交互体验优化建议

目前的交互体验不是很好,会经常出现响应超时的情况。这虽然是不可避免的,但是可以改善一下目前的交互体验。有以下建议:

  1. 目前出现超时时,就会提示超时,需要用户输入 retry 才能继续。可以考虑将所有超时的回答都放入一个未读消息池。每次出现请求超时时,都从未读消息池里面取出一个返回给用户(因为这时的回答和上一个的问题会对不上,所以需要提醒用户,将该回答和对应的问题都展示给用户),而不是直接提示超时,以减少交互次数。
  2. 每次重试时,如果出现该问题还在处理中,没有准备好,这时可以等待13s后再次重试,如果还是没有准备好,就会拉取未读消息池,避免浪费每一次对话机会。

暂时想到这些,上述逻辑已经我的仓库中实现了,如果可以的话,我后续会提交 PR。

也希望能交流一下,看看还有没有其他更好的方法。

cloudflare 实现限流/锁功能

KV 不同节点同步需要时间,适合常读少写的场景。

https://developers.cloudflare.com/workers/learning/how-kv-works/

KV achieves this performance by being eventually-consistent. Changes are usually immediately visible in the Cloudflare network edge location at which they are made but may take up to 60 seconds to be visible in other network edge locations as their cached versions of the data time out. In particular, visibility of changes takes longer in locations which have recently read a previous version of a given key (including reads that indicated the key did not exist, which are also cached locally). Workers KV is not ideal for situations where you need support for atomic operations or where values must be read and written in a single transaction.

对于限流/锁这种需要高频写/原子性操作的,看起来用 Durable Objects,但是要开付费才能用

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency typescript to v5.1.3
  • chore(deps): update dependency vitest-environment-miniflare to v2.14.0
  • chore(deps): update dependency wrangler to v3.1.0
  • chore(deps): update typescript-eslint monorepo to v5.59.11 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • fix(deps): update dependency fast-xml-parser to v4.2.4
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • actions/setup-node v3
  • ncipollo/release-action v1
.github/workflows/clean-cache.yml
  • actions/checkout v3
.github/workflows/deploy.yml
  • actions/checkout v3
  • actions/setup-node v3
  • cloudflare/wrangler-action 2.0.0
.github/workflows/test.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • fast-xml-parser ^4.1.3
  • @cloudflare/workers-types ^4.20230307.0
  • @commitlint/cli ^17.5.0
  • @commitlint/config-conventional ^17.4.4
  • @types/lodash ^4.14.191
  • @typescript-eslint/eslint-plugin ^5.56.0
  • @typescript-eslint/parser ^5.56.0
  • @vitest/coverage-c8 ^0.31.0
  • @wecom/crypto ^1.0.1
  • conventional-changelog-cli ^2.2.2
  • cz-conventional-changelog ^3.3.0
  • esbuild ^0.17.13
  • eslint ^8.36.0
  • husky ^8.0.3
  • lint-staged ^13.2.0
  • openai ^3.2.1
  • tsx ^3.12.3
  • typescript ^5.0.0
  • vitest ^0.31.0
  • vitest-environment-miniflare ^2.12.1
  • wrangler ^3.0.0
  • zod ^3.21.4

  • Check this box to trigger a request for Renovate to run again on this repository

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.