尝试最初版

This commit is contained in:
wood chen 2024-01-28 01:57:06 +08:00
parent 5b87b5e85b
commit e2f67a8a7f
7 changed files with 56 additions and 71 deletions

View File

@ -1,42 +0,0 @@
name: Docker
on:
push:
branches:
- main
tags:
- v*
env:
IMAGE_NAME: oapi-feishu
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 检出代码库
uses: actions/checkout@v3
- name: 构建镜像
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: 登录到镜像仓库
run: echo "${{ secrets.ACCESS_TOKEN }}" | docker login -u woodchen --password-stdin
- name: 推送镜像
run: |
IMAGE_ID=woodchen/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# 从 GitHub 事件负载中获取分支名
BRANCH_NAME=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# 对于除了 "main" 分支和标签以外的分支,使用 "latest" 版本号
VERSION=$(if [ "$BRANCH_NAME" == "main" ]; then echo "latest"; else echo $BRANCH_NAME; fi)
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

45
.gitignore vendored Normal file
View File

@ -0,0 +1,45 @@
### Go template
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
./code/target
.idea
.vscode
.s
config.yaml
/code/target/
start-feishubot
.env
docker.md
# Mac OS
.DS_Store
**/.DS_Store
*.pem
pkg
# 方便在本地放一些不用上传给 github 的文档,只需要在本地建立一个 ignore 文件夹,然后把需要忽略的文件放进去就行了
ignore
logs

View File

@ -25,7 +25,7 @@ OPENAI_HTTP_CLIENT_TIMEOUT:
OPENAI_MODEL: gpt-3.5-turbo
# AZURE OPENAI
AZURE_ON: false # set to true to use Azure rather than OpenAI
AZURE_ON: true # set to true to use Azure rather than OpenAI
AZURE_API_VERSION: 2023-03-15-preview # 2023-03-15-preview or 2022-12-01 refer https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#completions
AZURE_RESOURCE_NAME: xxxx # you can find in endpoint url. Usually looks like https://{RESOURCE_NAME}.openai.azure.com
AZURE_DEPLOYMENT_NAME: xxxx # usually looks like ...openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}/chat/completions.

View File

@ -6,13 +6,12 @@ import (
"encoding/base64"
"errors"
"fmt"
"start-feishubot/initialization"
"start-feishubot/services"
"start-feishubot/services/openai"
"github.com/google/uuid"
larkcard "github.com/larksuite/oapi-sdk-go/v3/card"
larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
"start-feishubot/initialization"
"start-feishubot/services"
"start-feishubot/services/openai"
)
type CardKind string

View File

@ -1,3 +1,7 @@
# 可在此处提交你认为不错的角色预设,注意保持格式一致。
# PR 时的 tag 暂时集中在 [ "日常办公", "生活助手" ,"代码专家", "文案撰写"]
# 更多点子可参考我另一个参与的项目: https://open-gpt.app/
- title: 周报生成
content: 请帮我把以下的工作内容填充为一篇完整的周报,用 markdown 格式以分点叙述的形式输出:
example: 重新优化设计稿,和前端再次沟通 UI 细节,确保落地

View File

@ -6,7 +6,7 @@ import (
"time"
)
// https://api.openai.com/dashboard/billing/credit_grants
// https://oapi.czl.net/dashboard/billing/credit_grants
type Billing struct {
Object string `json:"object"`
TotalGranted float64 `json:"total_granted"`

View File

@ -5,29 +5,8 @@ import (
)
const (
Fresh AIMode = 0.1
Warmth AIMode = 0.4
Balance AIMode = 0.7
Creativity AIMode = 1.0
)
var AIModeMap = map[string]AIMode{
"清新": Fresh,
"温暖": Warmth,
"平衡": Balance,
"创意": Creativity,
}
var AIModeStrs = []string{
"清新",
"温暖",
"平衡",
"创意",
}
const (
maxTokens = 4096
engine = "gpt-4-0613"
maxTokens = 2000
temperature = 0.7
)
type Messages struct {