Skip to content

Commit 7f11dd0

Browse files
authored
Merge pull request #11 from xh-polaris/moonlight
管理后台和数据看板
2 parents 8c0a3d8 + a1f8860 commit 7f11dd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+11710
-324
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ _testmain.go
3636
dumped_hertz_remote_config.json
3737

3838
/etc/
39+
/test/
40+
/psych-core-api

.idea/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/psych-core-api.iml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ new:
3737
hz new $(IDL_OPTIONS) $(OUTPUT_OPTIONS) --service $(SERVICE_NAME) --mod $(MODULE_NAME) $(EXTRA_OPTIONS)
3838
clean:
3939
rm -r ./output
40+
swag:
41+
swag init -g main.go --parseDependency --parseInternal
42+
idl:
43+
go get github.com/xh-polaris/psych-idl@main

biz/adaptor/controller/core.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ import (
44
"context"
55

66
"github.com/cloudwego/hertz/pkg/app"
7-
"github.com/xh-polaris/psych-core-api/biz/application/service"
7+
"github.com/hertz-contrib/websocket"
8+
"github.com/xh-polaris/psych-core-api/biz/domain/engine"
89
"github.com/xh-polaris/psych-core-api/pkg/logs"
910
"github.com/xh-polaris/psych-core-api/pkg/wsx"
11+
"github.com/xh-polaris/psych-core-api/provider"
1012
)
1113

1214
// Chat 对话接口
1315
// @router /chat [GET]
1416
func Chat(ctx context.Context, c *app.RequestContext) {
15-
if err := wsx.UpgradeWs(ctx, c, service.ChatHandler); err != nil {
17+
handler := func(wsCtx context.Context, conn *websocket.Conn) {
18+
p := provider.Get()
19+
engine.NewEngine(wsCtx, conn, &p.UserService, &p.ConfigService).Run()
20+
}
21+
if err := wsx.UpgradeWs(ctx, c, handler); err != nil {
1622
logs.Error("[controller] [Chat] websocket upgrade error:", err)
1723
}
1824
}

biz/adaptor/controller/core_api/completion.go

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)