Skip to content

Commit

Permalink
♻️ refactor: package upgrade and refactor code
Browse files Browse the repository at this point in the history
1. **devcontainer.json**:
   - Commend detailed steps for new image setup.
2. **chatgpt-mattermost-bot.code-workspace**:
   - Added Docker extension recommendation.
3. **compose.yaml**:
   - Fixed typo in service name.
4. **botservice.mjs**:
   - Added function to shorten long strings.
   - Added names to message roles.
   - Improved image resizing and format conversion logic.
5. **package.json**:
   - Updated dependency versions.
     @anthropic-ai/sdk                 ^0.20.5  →    ^0.21.1
     @eslint/js                         ^9.0.0  →     ^9.3.0
     @google/generative-ai              ^0.7.0  →    ^0.11.4
     @mattermost/client                 ^9.6.0  →     ^9.7.0
     @mattermost/types                  ^9.6.0  →     ^9.7.0
     @swc/core                         ^1.4.14  →     ^1.5.7
     @swc/helpers                      ^0.5.10  →    ^0.5.11
     @types/node                      ^20.12.7  →  ^20.12.12
     cohere-ai                          ^7.9.4  →    ^7.10.1
     esbuild                           ^0.20.2  →    ^0.21.3
     eslint                             ^9.0.0  →     ^9.3.0
     openai                            ^4.35.0  →    ^4.47.1
     rimraf                             ^5.0.5  →     ^5.0.7
     sharp                             ^0.33.3  →    ^0.33.4
     textlint-rule-preset-ja-spacing    ^2.3.1  →     ^2.4.3
     tsx                                ^4.7.2  →    ^4.11.0
     typescript-eslint                  ^7.7.0  →    ^7.10.0
     vitest                             ^1.5.0  →     ^1.6.0
     ws                                ^8.16.0  →    ^8.17.0
6. **CohereAdapter.ts**:
   - Refactored code.
7. **GoogleGeminiAdapter.ts**:
   - Added function to shorten long strings.
   - Added names to message roles.
8. **botservice.ts**:
   - Added user names to messages.
9. **openai-wrapper.ts**:
   - Added logging for chat completions.
   - Added names to message roles.
10. **postMessage.ts**:
    - Added user names to messages.

- Added support for environment variables to enhance application flexibility.
- Refactored code to improve readability and maintainability.
- Updated dependencies to apply the latest features and security patches.
  • Loading branch information
takuya-o committed May 25, 2024
1 parent c94eb9d commit f50687b
Show file tree
Hide file tree
Showing 11 changed files with 1,668 additions and 923 deletions.
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
// 新しいイメージを持ってきたらsudo -E "apt update && apt install git-secrets connect-proxy"や~/.ssh/configが必要
// 新しいイメージを持ってきたら
// ID=$(docker ps |awk '$2~/^vsc-/{print $1}')
// docker exec -u=root $ID sh -c "apt update && apt install git-secrets connect-proxy"
// docker cp ~/.ssh/config $ID:/home/node/.ssh/
// が必要
// 鍵についてはssh-add -l で確認
// 環境変数http_proxyや~/.gitconfigは、コンテナ作成時の値が自動的に登録されている。
3 changes: 2 additions & 1 deletion chatgpt-mattermost-bot.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"taichi.vscode-textlint"
"taichi.vscode-textlint",
"ms-azuretools.vscode-docker"
]
}
}
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
services:
chatcpt:
chatgpt:
image: ${CI_REGISTRY_IMAGE:-gitlab.example.com/user/chatgpt-mattermost-bot}:${CI_COMMIT_REF_NAME:-local}
build:
context: .
Expand Down
Loading

0 comments on commit f50687b

Please sign in to comment.