Skip to content

Commit

Permalink
Merge branch 'main' into feat/staging
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitoyama committed Sep 27, 2024
2 parents 30a8981 + bcceafe commit 41693ea
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 49 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ jobs:
go-version-file: ./go.mod
- run: make test-unit

test-integration:
name: Integration Test
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: make test-integration
# test-integration:
# name: Integration Test
# runs-on: ubuntu-latest
# needs:
# - build
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version-file: ./go.mod
# - run: make test-integration

dependabot-automerge:
name: Dependabot Automerge
Expand All @@ -67,7 +67,7 @@ jobs:
- build
- lint
- test-unit
- test-integration
# - test-integration
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build: $(GO_FILES) ## Compile the binary
go build -o $(APP_NAME)

.PHONY: test
test: test-unit test-integration ## Run all the tests
test: test-unit #test-integration ## Run all the tests

.PHONY: test-unit
test-unit: ## Run the unit tests
Expand Down
49 changes: 25 additions & 24 deletions internal/bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"github.com/traPtitech/go-traq"
_ "github.com/traPtitech/go-traq"
traqwsbot "github.com/traPtitech/traq-ws-bot"
"log"
"os"
Expand Down Expand Up @@ -83,6 +82,7 @@ func IsBotJoined(ChannelID string) (bool, error) {
return true, nil
}
}

return false, nil
}

Expand All @@ -96,26 +96,27 @@ func GetBots() []traq.Bot {
return Bots
}

func botToUser(bot traq.Bot) traq.User {
user := traq.User{
Id: bot.Id,
Name: bot.BotUserId,
DisplayName: "",
IconFileId: "",
Bot: true,
State: botStateToUserState(bot.State),
UpdatedAt: bot.UpdatedAt,
}

return user
}

func botStateToUserState(botState traq.BotState) traq.UserAccountState {
switch botState {
case traq.BOTSTATE_deactivated:
return traq.USERACCOUNTSTATE_deactivated
case traq.BOTSTATE_active:
return traq.USERACCOUNTSTATE_active
}
return traq.USERACCOUNTSTATE_suspended
}
//func botToUser(bot traq.Bot) traq.User {
// user := traq.User{
// Id: bot.Id,
// Name: bot.BotUserId,
// DisplayName: "",
// IconFileId: "",
// Bot: true,
// State: botStateToUserState(bot.State),
// UpdatedAt: bot.UpdatedAt,
// }
//
// return user
//}
//
//func botStateToUserState(botState traq.BotState) traq.UserAccountState {
// switch botState {
// case traq.BOTSTATE_deactivated:
// return traq.USERACCOUNTSTATE_deactivated
// case traq.BOTSTATE_active:
// return traq.USERACCOUNTSTATE_active
// }
//
// return traq.USERACCOUNTSTATE_suspended
//}
24 changes: 12 additions & 12 deletions internal/gpt/gpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,18 @@ func addSystemMessageIfNotExist(channelID, message string) {
}
}

func updateSystemRoleMessage(channelID, message string) {
addSystemMessageIfNotExist(channelID, message)
ChannelMessages[channelID][0] = Message{
Role: "system",
Content: message,
}

index := 0
if err := repository.SaveMessage(channelID, index, ChannelMessages[channelID][0]); err != nil {
fmt.Println(err)
}
}
//func updateSystemRoleMessage(channelID, message string) {
// addSystemMessageIfNotExist(channelID, message)
// ChannelMessages[channelID][0] = Message{
// Role: "system",
// Content: message,
// }
//
// index := 0
// if err := repository.SaveMessage(channelID, index, ChannelMessages[channelID][0]); err != nil {
// fmt.Println(err)
// }
//}

//func ChatDebug(channelID string) {
// returnString := "```\n"
Expand Down

0 comments on commit 41693ea

Please sign in to comment.