Git Product home page Git Product logo

demo-of-chat-in-issue's People

Contributors

wkgcass avatar

Stargazers

 avatar

Watchers

 avatar

demo-of-chat-in-issue's Issues

chat-in-issue的README翻译

/chat:请将如下中文markdown格式的文件翻译为英文,并保留markdown格式

chat-in-issue

通过Github Actions,在issue中使用OpenAI ChatGPT。

如何使用

快速启动!

如果只是想使用ChatGPT而不关心与已有仓库的集成,可以直接fork demo仓库
然后按照那个仓库README中记录的步骤进行配置即可。

在已有仓库中使用Action

在仓库中创建文件:/.github/workflows/chat-in-issue.yaml

name: chat-in-issue
run-name: '[chat-in-issue][${{ github.workflow }}] - ${{ github.event.issue.title }}'
on:
  issues:
    types: ['opened']
  issue_comment:
    types: ['created']
jobs:
  chat-in-issue:
    if: ${{ !github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - uses: wkgcass/chat-in-issue@v1
        with:
          openai-key: ${{ secrets.OPENAI_KEY }}
          user-whitelist: ${{ vars.CHAT_IN_ISSUE_USER_WHITELIST }}

该配置将读取Secrets中的OPENAI_KEY配置,以及Variables中的CHAT_IN_ISSUE_USER_WHITELIST配置。
如果你的仓库是public仓库,那么则建议配置user-whitelist,否则该配置可以视情况省略。

配置项

支持如下配置项:

token

Github token。默认使用${{ github.token }},需要配置读写权限(默认的workflow token权限为只读)。

具体会调用的API如下:

  • 读取issue
  • 读取和写入issue comment
  • 读取issue comment列表

openai-key

必填项

调用Openai API所使用的密钥,一般以"sk-"开头。

推荐将该key配置在"Secrets"中。

issue-number

触发事件的issue。默认使用${{ github.event.issue.number }}

一般省略不写即可。

comment-id

触发事件的comment。默认使用${{ github.event.comment.id }},可能为空。

一般省略不写即可。

prefix

Issue或评论的内容应当以这里配置的"$prefix"为开头,具体格式为"/$prefix:"。
比方说,如果前缀配置为"chat",那么只有以"/chat:"开头的issue或评论才会触发prompt。
多个前缀可以用逗号分隔。
请注意,有一些不应使用的前缀:

  • /ai-says: 响应信息,在prompt中会被作为role=assistant消息
  • /err: 错误信息,以该字符串开头的issue或评论不会作为prompt的一部分
  • /system: 不会触发prompt,但是会被作为role=system消息

如果消息包含的字符串恰好为"submit",则该消息本身将不会用作prompt的一部分。

prefix的默认值为chat

user-whitelist

用户白名单。仅白名单上的用户可以触发prompt。白名单的每一行是一个正则表达式,任何一行的正则检查通过则算作通过。
如果不写,则使用默认值.*(全部允许)。

建议将白名单配置在Variables中。

prompt-limit

该配置可与prompt-from-beginning-max配合使用。

Prompt最大字符数限制。

如果整个聊天上下文的总字数不超过该值,则所有内容都将作为prompt消息。
否则将从最前面开始,取不超过$prompt-from-beginning-max指定的数量的字符;然后再从最后面开始,取总量不超过本配置的字符。

如果某条消息被截断,则该消息整体都会被丢弃。

默认值为3000

prompt-from-beginning-max

该配置可与prompt-limit配合使用。

从聊天上下文的最前面开始计算的最大字符数。

默认值为500

翻译markdown文档

/system: 将用户输入的中文markdown文档翻译为英文,并保留markdown格式

日报

/chat: 帮我写一份日报,我今天吃了三顿饭,打了四次卡

光速不变

/chat: 请以“光速不变”为题,写一篇不少于500字的文字,并且使用markdown格式撰写。

Welcome to chat-in-issue

/chat: 我做了一个叫做“chat-in-issue”的github action。借助这个github action,我们可以通过创建及评论issue来使用OpenAI提供的服务,也包括ChatGPT服务。
帮我为来到这个仓库的人们写一篇简短的欢迎语吧。

请先用中文描述,然后再翻译成英文。

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.