Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
srvpro2
Commits
1696a557
Commit
1696a557
authored
Feb 16, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chatgpt
parent
e20a49e9
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
427 additions
and
5 deletions
+427
-5
config.example.yaml
config.example.yaml
+9
-0
src/config.ts
src/config.ts
+16
-0
src/feats/chatgpt-service.ts
src/feats/chatgpt-service.ts
+389
-0
src/feats/feats-module.ts
src/feats/feats-module.ts
+3
-1
src/feats/index.ts
src/feats/index.ts
+1
-0
src/feats/reconnect/index.ts
src/feats/reconnect/index.ts
+4
-1
src/feats/reconnect/refresh-field-service.ts
src/feats/reconnect/refresh-field-service.ts
+1
-2
src/koishi/commands-service.ts
src/koishi/commands-service.ts
+4
-1
No files found.
config.example.yaml
View file @
1696a557
...
...
@@ -51,6 +51,15 @@ windbotBotlist: ./windbot/bots.json
windbotSpawn
:
0
windbotEndpoint
:
http://127.0.0.1:2399
windbotMyIp
:
127.0.0.1
enableChatgpt
:
0
chatgptEndpoint
:
https://api.openai.com
chatgptToken
:
sk-xxxx
chatgptModel
:
gpt-4o-mini
chatgptSystemPrompt
:
你是{{windbot}},一名与{{player}}实时互动的游戏对手。玩家当前 locale 是
{{locale}},你必须始终使用 {{language}}
回复(不要混用其他语言)。你的回复应简短、有趣、贴合当前情境,增强玩家沉浸感。避免冗长解释或重复内容,并且每次回复不能超过100个字。
chatgptTokenLimit
:
12000
chatgptExtraOpts
:
{}
enableReconnect
:
1
reconnectTimeout
:
180000
hidePlayerName
:
0
...
...
src/config.ts
View file @
1696a557
...
...
@@ -119,6 +119,22 @@ export const defaultConfig = {
WINDBOT_ENDPOINT
:
'
http://127.0.0.1:2399
'
,
// Public IP/host that windbot uses to connect back to this server.
WINDBOT_MY_IP
:
'
127.0.0.1
'
,
// Enable chatgpt feature for AI-room chat replies.
// Boolean parse rule (default false): ''/'0'/'false'/'null' => false, otherwise true.
ENABLE_CHATGPT
:
'
0
'
,
// Chat completions API endpoint. Format: URL string.
CHATGPT_ENDPOINT
:
'
https://api.openai.com
'
,
// Chat completions API token.
CHATGPT_TOKEN
:
'
sk-xxxx
'
,
// Chat model.
CHATGPT_MODEL
:
'
gpt-4o-mini
'
,
// Optional system prompt template. Supports {{player}} and {{windbot}} placeholders.
CHATGPT_SYSTEM_PROMPT
:
'
你是{{windbot}},一名与{{player}}实时互动的游戏对手。玩家当前 locale 是 {{locale}},你必须始终使用 {{language}} 回复(不要混用其他语言)。你的回复应简短、有趣、贴合当前情境,增强玩家沉浸感。避免冗长解释或重复内容,并且每次回复不能超过100个字。
'
,
// Token limit used to trim stored conversation context.
CHATGPT_TOKEN_LIMIT
:
'
12000
'
,
// Extra request options for chat completions. Format: JSON object string.
CHATGPT_EXTRA_OPTS
:
'
{}
'
,
// Enable reconnect feature.
// Boolean parse rule (default true): only '0'/'false'/'null' => false, otherwise true.
// Note: with default-true parsing, empty string is treated as true.
...
...
src/feats/chatgpt-service.ts
0 → 100644
View file @
1696a557
This diff is collapsed.
Click to expand it.
src/feats/feats-module.ts
View file @
1696a557
...
...
@@ -13,16 +13,18 @@ import { MenuManager } from './menu-manager';
import
{
ClientKeyProvider
}
from
'
./client-key-provider
'
;
import
{
HidePlayerNameProvider
}
from
'
./hide-player-name-provider
'
;
import
{
CommandsService
,
KoishiContextService
}
from
'
../koishi
'
;
import
{
ChatgptService
}
from
'
./chatgpt-service
'
;
export
const
FeatsModule
=
createAppContext
<
ContextState
>
()
.
provide
(
ClientKeyProvider
)
.
provide
(
HidePlayerNameProvider
)
.
provide
(
KoishiContextService
)
.
provide
(
CommandsService
)
.
provide
(
CommandsService
)
// some chat commands
.
provide
(
MenuManager
)
.
provide
(
ClientVersionCheck
)
.
provide
(
Welcome
)
.
provide
(
PlayerStatusNotify
)
.
provide
(
ChatgptService
)
// AI-room chat replies
.
provide
(
RefreshFieldService
)
.
provide
(
Reconnect
)
.
provide
(
WaitForPlayerProvider
)
// chat refresh
...
...
src/feats/index.ts
View file @
1696a557
export
*
from
'
./client-version-check
'
;
export
*
from
'
./client-key-provider
'
;
export
*
from
'
./chatgpt-service
'
;
export
*
from
'
./hide-player-name-provider
'
;
export
*
from
'
./menu-manager
'
;
export
*
from
'
./welcome
'
;
...
...
src/feats/reconnect/index.ts
View file @
1696a557
...
...
@@ -509,7 +509,10 @@ export class Reconnect {
}),
);
await
this
.
refreshFieldService
.
sendReconnectDuelingMessages
(
newClient
,
room
);
await
this
.
refreshFieldService
.
sendReconnectDuelingMessages
(
newClient
,
room
,
);
}
private
importClientData
(
newClient
:
Client
,
oldClient
:
Client
,
room
:
Room
)
{
...
...
src/feats/reconnect/refresh-field-service.ts
View file @
1696a557
...
...
@@ -36,8 +36,7 @@ export class RefreshFieldService {
await
client
.
send
(
await
this
.
requestField
(
room
));
await
this
.
sendRefreshMessages
(
client
,
room
);
const
needResendRequest
=
this
.
isReconnectingPlayerOperating
(
client
,
room
);
const
needResendRequest
=
this
.
isReconnectingPlayerOperating
(
client
,
room
);
if
(
needResendRequest
)
{
const
lastHint
=
this
.
findLastHintForClient
(
client
,
room
);
...
...
src/koishi/commands-service.ts
View file @
1696a557
...
...
@@ -34,7 +34,10 @@ export class CommandsService {
if
(
!
commandContext
)
{
return
;
}
await
this
.
ctx
.
dispatch
(
new
YGOProCtosSurrender
(),
commandContext
.
client
);
await
this
.
ctx
.
dispatch
(
new
YGOProCtosSurrender
(),
commandContext
.
client
,
);
});
koishi
.
command
(
'
roomname
'
,
''
).
action
(({
session
})
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment