Skip to content

Commit 3d2a1b4

Browse files
committed
feat(homeviewmodel): update LLBot startup process for improved reliability and version bump to 2.6.2
1 parent eec47c1 commit 3d2a1b4

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

LuckyLilliaDesktop.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Product>Lucky Lillia Desktop</Product>
1212
<AssemblyTitle>Lucky Lillia Desktop</AssemblyTitle>
1313
<Description>幸运莉莉娅桌面端</Description>
14-
<Version>2.6.1</Version>
14+
<Version>2.6.2</Version>
1515
</PropertyGroup>
1616

1717
<!-- Windows特定配置 -->

ViewModels/HomeViewModel.cs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,25 @@ private async Task StartAllServicesAsync()
11211121
{
11221122
_logger.LogInformation("PMHQ 启动成功");
11231123

1124+
// 先启动 LLBot,确保 WebSocket 服务就绪,避免错过 QQ 事件
1125+
_logger.LogInformation("正在启动 LLBot...");
1126+
var llbotSuccess = await _processManager.StartLLBotAsync(
1127+
config.NodePath,
1128+
config.LLBotPath);
1129+
1130+
if (llbotSuccess)
1131+
{
1132+
_logger.LogInformation("LLBot 启动成功");
1133+
IsServicesRunning = true;
1134+
}
1135+
else
1136+
{
1137+
ErrorMessage = "LLBot 启动失败,请检查日志";
1138+
_logger.LogError("LLBot 启动失败");
1139+
BotStatus = ProcessStatus.Stopped;
1140+
return;
1141+
}
1142+
11241143
// 设置 PmhqClient 端口并开始轮询
11251144
if (_processManager.PmhqPort.HasValue)
11261145
{
@@ -1244,30 +1263,10 @@ private async Task StartAllServicesAsync()
12441263

12451264
StartInfoPolling();
12461265

1247-
// 等待一段时间后启动 LLBot
1248-
await Task.Delay(2000);
1266+
BotStatus = ProcessStatus.Running;
12491267

1250-
// 启动 LLBot
1251-
_logger.LogInformation("正在启动 LLBot...");
1252-
var llbotSuccess = await _processManager.StartLLBotAsync(
1253-
config.NodePath,
1254-
config.LLBotPath);
1255-
1256-
if (llbotSuccess)
1257-
{
1258-
_logger.LogInformation("LLBot 启动成功");
1259-
IsServicesRunning = true;
1260-
BotStatus = ProcessStatus.Running;
1261-
1262-
// 执行启动后命令
1263-
await ExecuteStartupCommandAsync(config);
1264-
}
1265-
else
1266-
{
1267-
ErrorMessage = "LLBot 启动失败,请检查日志";
1268-
_logger.LogError("LLBot 启动失败");
1269-
BotStatus = ProcessStatus.Stopped;
1270-
}
1268+
// 执行启动后命令
1269+
await ExecuteStartupCommandAsync(config);
12711270
}
12721271
else
12731272
{

0 commit comments

Comments
 (0)