wkgcass / demo-of-chat-in-issue Goto Github PK
View Code? Open in Web Editor NEWA demo repo of chat-in-issue github action: github.com/wkgcass/chat-in-issue
License: Creative Commons Zero v1.0 Universal
A demo repo of chat-in-issue github action: github.com/wkgcass/chat-in-issue
License: Creative Commons Zero v1.0 Universal
/chat: 如果一个人能回答出百度贴吧“弱智吧”里的问题,那么他到底是弱智还是正常人?
/chat:请将如下中文markdown格式的文件翻译为英文,并保留markdown格式
通过Github Actions,在issue中使用OpenAI ChatGPT。
如果只是想使用ChatGPT而不关心与已有仓库的集成,可以直接fork demo仓库。
然后按照那个仓库README中记录的步骤进行配置即可。
在仓库中创建文件:/.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
,否则该配置可以视情况省略。
支持如下配置项:
Github token。默认使用${{ github.token }}
,需要配置读写权限(默认的workflow token权限为只读)。
具体会调用的API如下:
必填项
调用Openai API所使用的密钥,一般以"sk-"开头。
推荐将该key配置在"Secrets"中。
触发事件的issue。默认使用${{ github.event.issue.number }}
。
一般省略不写即可。
触发事件的comment。默认使用${{ github.event.comment.id }}
,可能为空。
一般省略不写即可。
Issue或评论的内容应当以这里配置的"$prefix"为开头,具体格式为"/$prefix:"。
比方说,如果前缀配置为"chat",那么只有以"/chat:"开头的issue或评论才会触发prompt。
多个前缀可以用逗号分隔。
请注意,有一些不应使用的前缀:
/ai-says:
响应信息,在prompt中会被作为role=assistant
消息/err:
错误信息,以该字符串开头的issue或评论不会作为prompt的一部分/system:
不会触发prompt,但是会被作为role=system
消息如果消息包含的字符串恰好为"submit",则该消息本身将不会用作prompt的一部分。
prefix
的默认值为chat
。
用户白名单。仅白名单上的用户可以触发prompt。白名单的每一行是一个正则表达式,任何一行的正则检查通过则算作通过。
如果不写,则使用默认值.*
(全部允许)。
建议将白名单配置在Variables
中。
该配置可与prompt-from-beginning-max
配合使用。
Prompt最大字符数限制。
如果整个聊天上下文的总字数不超过该值,则所有内容都将作为prompt消息。
否则将从最前面开始,取不超过$prompt-from-beginning-max
指定的数量的字符;然后再从最后面开始,取总量不超过本配置的字符。
如果某条消息被截断,则该消息整体都会被丢弃。
默认值为3000
。
该配置可与prompt-limit
配合使用。
从聊天上下文的最前面开始计算的最大字符数。
默认值为500
。
/system: 将用户输入的中文markdown文档翻译为英文,并保留markdown格式
/chat: 帮我写一份日报,我今天吃了三顿饭,打了四次卡
/chat: 请以“光速不变”为题,写一篇不少于500字的文字,并且使用markdown格式撰写。
/chat: 我做了一个叫做“chat-in-issue”的github action。借助这个github action,我们可以通过创建及评论issue来使用OpenAI提供的服务,也包括ChatGPT服务。
帮我为来到这个仓库的人们写一篇简短的欢迎语吧。
请先用中文描述,然后再翻译成英文。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.