Skip to content

Commit cca971f

Browse files
committed
add log to monitor the fucking 500
1 parent d2de7c9 commit cca971f

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
with:
4343
push: true
4444
tags: |
45+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}:latest
4546
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}:master
4647
4748

apis/hole/apis.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ func GenerateSummary(c *fiber.Ctx) error {
826826
return c.Status(200).JSON(cachedData)
827827
case 1001:
828828
// get new summary
829-
resp, err := http.Get(config.Config.AISummaryURL + "/get_summary?code=1000&hole_id=" + strconv.Itoa(id))
829+
resp, err := http.Get(config.Config.AISummaryURL + "/get_summary?hole_id=" + strconv.Itoa(id))
830830
if err != nil {
831831
log.Err(err).Msg("AISummary: get summary from server err")
832832
return err
@@ -947,8 +947,7 @@ func GenerateSummary(c *fiber.Ctx) error {
947947
Message string `json:"message"`
948948
Data struct{} `json:"data"`
949949
}
950-
951-
resp, err := http.Post(config.Config.AISummaryURL+"/generate_summary?code=1000", "application/json", bytes.NewReader(requestJSON))
950+
resp, err := http.Post(config.Config.AISummaryURL+"/generate_summary", "application/json", bytes.NewReader(requestJSON))
952951
if err != nil {
953952
log.Err(err).Msg("AISummary: generate summary from server err")
954953
response.Code = 3001
@@ -962,6 +961,15 @@ func GenerateSummary(c *fiber.Ctx) error {
962961
return err
963962
}
964963

964+
if resp.StatusCode != http.StatusOK {
965+
log.Error().
966+
Str("url", config.Config.AISummaryURL+"/generate_summary").
967+
Int("status", resp.StatusCode).
968+
Bytes("req_body", requestJSON).
969+
Bytes("resp_body", body).
970+
Msg("AISummary: generate summary server error")
971+
}
972+
965973
err = json.Unmarshal(body, &response)
966974
if err != nil {
967975
return err

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var Config struct {
5555
QQBotUrl *string `env:"QQ_BOT_URL"`
5656
FeishuBotUrl *string `env:"FEISHU_BOT_URL"`
5757
AdminOnlyTagIds []int `env:"ADMIN_ONLY_TAG_IDS"`
58-
AISummaryURL string `env:"AI_SUMMARY_URL" envDefault:"http://127.0.0.1:4523/m1/7787529-7534191-default/internal"`
58+
AISummaryURL string `env:"AI_SUMMARY_URL" envDefault:"http://127.0.0.1:8080/internal"`
5959
}
6060

6161
var DynamicConfig struct {

0 commit comments

Comments
 (0)