이 저장소에는 OpenAi의 GPT 모델을 사용하여 사용자의 질문에 답변하는 C#기반 Slack GPT 봇이 포함되어 있습니다. 구현은 Slack Sockets API를 기반으로하므로 서버에서 봇을 호스팅 할 필요가 없습니다. 봇은 모든 기계에서 실행할 수 있습니다.
이 도구가 마음에 드 셨나요? 우리에게 방문하십시오 :) https://prographers.com/
-context
에 대한 시스템 메시지 appsettings.json
의 OpenAIKey
변수에 넣으십시오.참고 : OpenAI API를 사용하려면 유료/평가판 계정이 필요합니다. 가격에 대한 자세한 내용은 여기를 참조하십시오.
Slack GPT 봇을 실행하기 전에 Slack Bot에 대한 적절한 권한을 구성해야합니다. 다음 단계에 따라 필요한 권한을 설정하십시오.
app_mentions:read
: 봇이 언급 이벤트를 읽도록 허용합니다.chat:write
: 봇이 메시지를 보낼 수 있습니다.groups:history
: 봇은 개인 채널에서 메시지를 읽을 수 있습니다.channels:history
: 봇은 공개 채널에서 메시지를 읽을 수 있습니다.SlackBotToken
생성합니다.SlackAppToken
이라는 토큰을 생성하고 connections:write
스코프.app_mention
이벤트 추가 app_mentions:read
. dotnet run --project Slack-GPT-Socket
또는 호스팅 방법에 대한 자세한 내용은 #Docker를 참조하십시오.
매개 변수없이 모델 이름으로 메시지를 시작할 수 있습니다.
@gpt-4 터보 오늘 어때?
기본 GPT-4 모델 대신 GPT-3.5-Turbo를 사용합니다. 더 많은 별칭은 gptclient를 참조하십시오.
내장 매개 변수가 있습니다. /gpt help
사용하여 그들을 볼 수 있습니다. appsettings.json
파일 또는 요청 당 매개 변수를 수정할 수 있습니다.
기본값 또는 appsettings.Example.json
에 대한 자세한 내용은 gptdefaults.cs를 참조하십시오.
사전 정의 된 명령
봇에 자신의 사용자 정의 매개 변수를 추가하여 각 회복 요청에 대한 타이핑을 최소화 할 수 있습니다. 그렇게하려면 appsettings.json
의 GptCommands
섹션에 IT 정의를 추가하십시오. 예를 들어:
"GptCommands" : {
"Commands" : [
{
"Command" : " -refactor " ,
"Description" : " Tells GPT to refactor provided code " ,
"Prompt" : " Given the following code, refactor it to be more readable and maintainable. Please provide code documentation for all members in the code and comments where appropriate. "
},
{
"Command" : " -prographers " ,
"Description" : " A command to add infomation about Prographers " ,
"Prompt" : " Prographers is software-house company that specializes in 3D product configurators. Prographers exists since 2016 and currently hires around 20 people. Prographers solutions focus on Web applications that are used by companies to configure their products. Applications produced are focusing on high-quality graphics and design, resulting in great products that customers awe. Prographers is located in Warsaw, Poland. "
}
}
용법:
@gpt -4- 전문가들은 프로토 그래미에 대해 무엇을 알고 있습니까?
@gpt -4-
public class Foo { public void Bar() { Console.WriteLine("Hello World"); } }
동적 명령
비슷한 방식으로 동적 명령을 만들 수 있습니다. 이렇게하려면 /gpt commands add -command "prompt" "description" -global
호출하십시오.
-command
이 명령이 호출되는 방법. 예 : -prographers
-prompt
. EG : Prographers is software-house company...
-description
명령의 설명. EG : A command to add infomation about Prographers
선택 사항입니다.-global
Flag는 모든 사용자가 명령을 사용할 수있게합니다. 그렇지 않으면 그것을 만든 사용자가 사용할 수 있습니다. /gpt commands help
사용하면 명령에 대한 자세한 정보를 볼 수 있습니다.
다음 명령으로 Docker 컨테이너를 시작할 수 있습니다.
docker run -v ./appsettings.json:/app/appsettings.json --restart always ghcr.io/prographers/slack-gpt:latest
docker-compose.yml
파일을 사용하여 컨테이너를 분리 할 수도 있습니다. Docker Compose는 Github 컨테이너 레지스트리에서 이미지를 자동으로 당기고 컨테이너가 발생하면 시작합니다. 이를 위해 워치 타워를 사용합니다.
docker-compose up -d
AppSettings.json 파일을 두 경우 모두 명령과 동일한 디렉토리에 넣으십시오.
두 이미지 모두 포트에 노출되지 않으며 외부에서 액세스 할 수 없습니다. 컨테이너에 액세스하는 유일한 방법은 Slack API를 통한 것입니다. 컨테이너는 또한 뿌리가 아닌 사용자로 실행되며 호스트 시스템에 액세스 할 수 없습니다.
git clone https://github.com/Prographers/Slack-GPT.git
cd Slack-GPT
dotnet restore
알림 메시지!
스레드 지원!
오류 메시지!