-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨feat(src/AIProvider.ts): Support Cohere Command R+
Support Cohere Command R+ and Anthropic Claude 3 by AI provider interface. Implemented a series of changes related to the development environment, code quality management, and project configuration. This includes updating the development container settings, adding samples for environment variables, introducing Textlint settings, updating VSCode workspace settings, improving Docker Compose configuration, refactoring source code, updating packages, adding a synchronization script, and adjusting TypeScript settings. These changes aim to streamline the development process, improve code readability and maintainability, and enhance the flexibility of project configuration. Updated the development environment settings to use a new Docker image. Added new variables to the environment variable sample file and introduced Textlint to improve document quality. Updated VSCode workspace settings with added debug configurations. Improved Docker Compose configuration for more flexible environment variable management. The source code includes abstraction of AI providers, refactoring, and addition of new features. Updated package dependencies and added a script to facilitate project synchronization. Finally, adjusted TypeScript settings to improve the development experience.
- Loading branch information
Showing
16 changed files
with
8,515 additions
and
3,837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
MATTERMOST_URL=https://mattermost.server.example | ||
MATTERMOST_TOKEN=abababacdcdcd | ||
#MATTERMOST_BOTNAME=@chatgpt | ||
# MATTERMOST_BOTNAME=@chatgpt | ||
PLUGINS=image-plugin | ||
|
||
# MAX_PROMPT_TOKEN=3000 | ||
# OPENAI_MAX_TOKENS=2000 | ||
# OPENAI_TEMPERATURE=1 | ||
|
||
OPENAI_API_KEY=sk-234234234234234234 | ||
# OPENAI_MODEL_NAME=gpt-3.5-turbo | ||
# OPENAI_VISION_MODEL_NAME=gpt-4-vision-preview | ||
# OPENAI_IMAGE_MODEL_NAME=dall-e-2 | ||
# OPENAI_VISION_MODEL_NAME=gpt-4-vision-preview | ||
|
||
# AZURE_OPENAI_API_KEY=0123456789abcdefghijklmno | ||
# AZURE_OPENAI_API_INSTANCE_NAME=example-name | ||
# AZURE_OPENAI_API_DEPLOYMENT_NAME=gpt-35-turbo | ||
# AZURE_OPENAI_API_VERSION=2023-12-01-preview | ||
|
||
#AZURE_OPENAI_API_KEY=0123456789abcdefghijklmno | ||
#AZURE_OPENAI_API_INSTANCE_NAME=example-name | ||
#AZURE_OPENAI_API_DEPLOYMENT_NAME=gpt-35-turbo | ||
#AZURE_OPENAI_API_VERSION=2023-09-01-preview | ||
#MAX_PROMPT_TOKEN=3000 | ||
#OPENAI_MAX_TOKENS=2000 | ||
#OPENAI_TEMPERATURE=1 | ||
# AZURE_OPENAI_IMAGE_API_KEY=0123456789abcdefghijklmno | ||
# AZURE_OPENAI_IMAGE_API_INSTANCE_NAME=example-name | ||
# AZURE_OPENAI_IMAGE_API_DEPLOYMENT_NAME=dall-e-2 | ||
|
||
#AZURE_OPENAI_VISION_API_KEY=0123456789abcdefghijklmno | ||
#AZURE_OPENAI_VISION_API_INSTANCE_NAME=example-name | ||
#AZURE_OPENAI_VISION_API_DEPLOYMENT_NAME=gpt-4-vision-prewview | ||
# AZURE_OPENAI_VISION_API_KEY=0123456789abcdefghijklmno | ||
# AZURE_OPENAI_VISION_API_INSTANCE_NAME=example-name | ||
# AZURE_OPENAI_VISION_API_DEPLOYMENT_NAME=gpt-4-vision-preview | ||
|
||
#AZURE_OPENAI_IMAGE_API_KEY=0123456789abcdefghijklmno | ||
#AZURE_OPENAI_IMAGE_API_INSTANCE_NAME=example-name | ||
#AZURE_OPENAI_IMAGE_API_DEPLOYMENT_NAME=dall-e-2 | ||
# DEBUG_LEVEL=INFO | ||
# DEBUG_JSON=true | ||
# DEBUG_COLORS=true | ||
|
||
#DEBUG_LEVEL=INFO | ||
#DEBUG_JSON=true | ||
#DEBUG_COLORS=true | ||
# CI_REGISTRY_IMAGE=gitlab.example.com/user/chatgpt-mattermost-bot | ||
# CI_COMMIT_REF_NAME=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// see: https://www.forcia.com/blog/002374.html | ||
{ | ||
"plugins": { | ||
"@textlint/markdown": { | ||
"extensions": [".md"], // マークダウン用の拡張 | ||
} | ||
}, | ||
"filters": {}, | ||
"rules": { | ||
// https://github.com/textlint-rule/textlint-rule-prh | ||
"prh": { // 文字揺れ校正 prhをプラグインで使う | ||
"checkBlockQuote": true, | ||
"checkEmphasis": true, | ||
"rulePaths": ["./prh.yml"], | ||
}, | ||
// textlint-rule-preset-jtf-styleの設定 | ||
"preset-jtf-style": { | ||
"1.2.1.句点(。)と読点(、)": false, // 文中のピリオドとカンマを許容 | ||
//"1.1.3.箇条書き": false, // 箇条書きの文末に句点(。)以外を許可 | ||
//"2.1.8.算用数字": false, // 算用数字以外も許容する。1桁は全角でも入力できるように。 | ||
"2.2.1.ひらがなと漢字の使い分け": true, // ひらがなにしたほうが良い漢字をサジェスト | ||
"4.1.3.ピリオド(.)、カンマ(,)": false, // 文中のピリオドとカンマを許容 | ||
"4.2.2.疑問符(?)": false, //半角:を許容 | ||
"4.2.7.コロン(:)": false, //半角:を許容 | ||
"4.3.1.丸かっこ()": false, // 半角丸括弧を許容 | ||
"4.3.2.大かっこ[]": false, // 半角大括弧を許容 | ||
}, | ||
// textlint-rule-preset-ja-technical-writingの設定 | ||
// https://github.com/textlint-ja/textlint-rule-preset-ja-technical-writing | ||
"preset-ja-technical-writing": { | ||
"no-exclamation-question-mark": { | ||
// https://github.com/textlint-rule/textlint-rule-no-exclamation-question-mark | ||
// "allow": ["Yahoo!"], | ||
"allowHalfWidthExclamation": true, | ||
"allowHalfWidthQuestion": true, | ||
"allowFullWidthExclamation": true, | ||
"allowFullWidthQuestion": true, | ||
}, | ||
"no-doubled-joshi": { | ||
"strict": false, | ||
"allow": ["か", "が", "に"], // これらの助詞は同一文中に多く登場しても許容 | ||
}, | ||
"max-ten": { "max": 5 }, // 文中の「、」の数は5個まで | ||
"sentence-length": false, // 文の長さは指定なし | ||
"ja-no-weak-phrase": false, // 弱い表現を許容 | ||
"max-comma": false, // カンマの数は指定なし | ||
}, | ||
// textlint-rule-preset-ja-spacingの設定 | ||
"preset-ja-spacing": { | ||
"ja-space-around-code": { // インラインコードの前後にスペースを入れなくてもよい | ||
"before": false, | ||
"after": false, | ||
}, | ||
}, | ||
|
||
// textlint init | ||
"no-mixed-zenkaku-and-hankaku-alphabet": true, | ||
//"preset-ja-spacing": true, | ||
//"preset-ja-technical-writing": true, | ||
//"preset-jtf-style": true, | ||
//"prh": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
--- | ||
services: | ||
chatbot: | ||
image: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME} | ||
build: . | ||
chatcpt: | ||
image: ${CI_REGISTRY_IMAGE:-gitlab.example.com/user/chatgpt-mattermost-bot}:${CI_COMMIT_REF_NAME:+local} | ||
build: | ||
context: . | ||
args: | ||
NODE_ENV: ${NODE_ENV:-production} | ||
restart: always | ||
environment: | ||
MATTERMOST_URL: ${MATTERMOST_URL} | ||
MATTERMOST_TOKEN: ${MATTERMOST_TOKEN} | ||
MATTERMOST_BOTNAME: ${MATTERMOST_BOTNAME} | ||
OPENAI_API_KEY: ${OPENAI_API_KEY} | ||
OPENAI_MODEL_NAME: ${OPENAI_MODEL_NAME} | ||
OPENAI_IMAGE_MODEL_NAME: ${OPENAI_IMAGE_MODEL_NAME} | ||
OPENAI_VISION_MODEL_NAME: ${OPENAI_VISION_MODEL_NAME} | ||
OPENAI_MAX_TOKENS: ${OPENAI_MAX_TOKENS} | ||
MAX_PROMPT_TOKENS: ${MAX_PROMPT_TOKENS} | ||
PLUGINS: ${PLUGINS} | ||
AZURE_OPENAI_API_KEY: ${AZURE_OPENAI_API_KEY} | ||
AZURE_OPENAI_API_INSTANCE_NAME: ${AZURE_OPENAI_API_INSTANCE_NAME} | ||
AZURE_OPENAI_API_DEPLOYMENT_NAME: ${AZURE_OPENAI_API_DEPLOYMENT_NAME} | ||
AZURE_OPENAI_API_VERSION: ${AZURE_OPENAI_API_VERSION} | ||
DEBUG_LEVEL: ${DEBUG_LEVEL} | ||
DEBUG_JSON: ${DEBUG_JSON} | ||
DEBUG_COLORS: ${DEBUG_COLORS} | ||
env_file: .env # Dockerfileでも有効にするために必須 | ||
# .envファイルより環境変数を有効にする場合 | ||
# environment: | ||
# MATTERMOST_URL: ${MATTERMOST_URL} | ||
# MATTERMOST_TOKEN: ${MATTERMOST_TOKEN} | ||
# MATTERMOST_BOTNAME: ${MATTERMOST_BOTNAME} | ||
# OPENAI_API_KEY: ${OPENAI_API_KEY} | ||
# OPENAI_MODEL_NAME: ${OPENAI_MODEL_NAME} | ||
# OPENAI_IMAGE_MODEL_NAME: ${OPENAI_IMAGE_MODEL_NAME} | ||
# OPENAI_VISION_MODEL_NAME: ${OPENAI_VISION_MODEL_NAME} | ||
# OPENAI_MAX_TOKENS: ${OPENAI_MAX_TOKENS} | ||
# MAX_PROMPT_TOKENS: ${MAX_PROMPT_TOKENS} | ||
# PLUGINS: ${PLUGINS} | ||
# AZURE_OPENAI_API_KEY: ${AZURE_OPENAI_API_KEY} | ||
# AZURE_OPENAI_API_INSTANCE_NAME: ${AZURE_OPENAI_API_INSTANCE_NAME} | ||
# AZURE_OPENAI_API_DEPLOYMENT_NAME: ${AZURE_OPENAI_API_DEPLOYMENT_NAME} | ||
# AZURE_OPENAI_API_VERSION: ${AZURE_OPENAI_API_VERSION} | ||
# DEBUG_LEVEL: ${DEBUG_LEVEL} | ||
# DEBUG_JSON: ${DEBUG_JSON} | ||
# DEBUG_COLORS: ${DEBUG_COLORS} | ||
|
||
cohere: | ||
image: ${CI_REGISTRY_IMAGE:-gitlab.example.com/user/chatgpt-mattermost-bot}:${CI_COMMIT_REF_NAME:+local} | ||
build: | ||
context: . | ||
args: | ||
NODE_ENV: ${NODE_ENV:-production} | ||
restart: always | ||
env_file: .env.cohere | ||
|
Oops, something went wrong.