Skip to content

Commit 2dacfb9

Browse files
committed
Version 1.0.3 is expected to be released.
1 parent 876d7be commit 2dacfb9

10 files changed

Lines changed: 432 additions & 217 deletions

File tree

lib/core/online_service/online_server.dart

Lines changed: 230 additions & 92 deletions
Large diffs are not rendered by default.

lib/core/online_service/online_service_config.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ class WhitelistEntry {
5959
factory WhitelistEntry.fromJson(Map<String, dynamic> json) => WhitelistEntry(
6060
ip: json['ip'] as String? ?? '',
6161
nickname: json['nickname'] as String? ?? '',
62-
allowedModelCardIds: (json['allowedModelCardIds'] as List?)
63-
?.cast<String>() ?? const [],
62+
allowedModelCardIds:
63+
(json['allowedModelCardIds'] as List?)?.cast<String>() ?? const [],
6464
mcpEnabled: json['mcpEnabled'] as bool? ?? false,
65-
mcpServerIds: (json['mcpServerIds'] as List?)
66-
?.cast<String>() ?? const [],
65+
mcpServerIds: (json['mcpServerIds'] as List?)?.cast<String>() ?? const [],
6766
skillEnabled: json['skillEnabled'] as bool? ?? false,
68-
skillIds: (json['skillIds'] as List?)
69-
?.cast<String>() ?? const [],
67+
skillIds: (json['skillIds'] as List?)?.cast<String>() ?? const [],
7068
searchProvider: json['searchProvider'] as String? ?? 'none',
7169
);
7270
}
@@ -117,9 +115,11 @@ class OnlineServiceConfig {
117115
port: json['port'] as int? ?? 2002,
118116
maxConnections: json['maxConnections'] as int? ?? 5,
119117
accepting: json['accepting'] as bool? ?? true,
120-
whitelist: (json['whitelist'] as List?)
121-
?.map((e) => WhitelistEntry.fromJson(e as Map<String, dynamic>))
122-
.toList() ?? const [],
118+
whitelist:
119+
(json['whitelist'] as List?)
120+
?.map((e) => WhitelistEntry.fromJson(e as Map<String, dynamic>))
121+
.toList() ??
122+
const [],
123123
);
124124

125125
/// 持久化路径
@@ -167,7 +167,9 @@ class OnlineServiceConfig {
167167
}
168168
// 通配符: "192.168.1.*"
169169
if (pattern.contains('*')) {
170-
final regex = RegExp('^${pattern.replaceAll('.', r'\.').replaceAll('*', r'\d+')}');
170+
final regex = RegExp(
171+
'^${pattern.replaceAll('.', r'\.').replaceAll('*', r'\d+')}',
172+
);
171173
return regex.hasMatch(clientIp);
172174
}
173175
return false;

lib/core/online_service/online_session.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ class UserModelConfig {
1818
required this.provider,
1919
});
2020

21-
factory UserModelConfig.fromJson(Map<String, dynamic> json) => UserModelConfig(
22-
id: json['id'] as String? ?? '',
23-
name: json['name'] as String? ?? '',
24-
baseUrl: json['baseUrl'] as String? ?? '',
25-
apiKey: json['apiKey'] as String? ?? '',
26-
modelId: json['modelId'] as String? ?? '',
27-
provider: json['provider'] as String? ?? 'openai',
28-
);
21+
factory UserModelConfig.fromJson(Map<String, dynamic> json) =>
22+
UserModelConfig(
23+
id: json['id'] as String? ?? '',
24+
name: json['name'] as String? ?? '',
25+
baseUrl: json['baseUrl'] as String? ?? '',
26+
apiKey: json['apiKey'] as String? ?? '',
27+
modelId: json['modelId'] as String? ?? '',
28+
provider: json['provider'] as String? ?? 'openai',
29+
);
2930

3031
Map<String, dynamic> toJson() => {
3132
'id': id,

lib/core/online_service/web_assets.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,4 +826,3 @@ document.addEventListener("drop",function(e){e.preventDefault();if(e.dataTransfe
826826
})();
827827
''';
828828
}
829-

lib/features/chat/chat_page.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,4 +2064,3 @@ class _ThinkingBarState extends State<_ThinkingBar>
20642064
return '$m:${s.toString().padLeft(2, '0')}';
20652065
}
20662066
}
2067-

lib/features/chat/chat_provider.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -573,17 +573,15 @@ class ChatNotifier extends StateNotifier<ChatState> {
573573
// 把工具调用历史也追加为消息(展示用)
574574
final toolMessages = state.activeToolCalls
575575
.where((tc) => tc.status == ToolCallStatus.done)
576-
.map((tc) => ChatMessage(
577-
role: ChatRole.assistant,
578-
content: '[工具调用] ${tc.name}',
579-
toolCalls: [
580-
ChatToolCall(
581-
id: tc.id,
582-
name: tc.name,
583-
arguments: tc.arguments,
584-
),
585-
],
586-
))
576+
.map(
577+
(tc) => ChatMessage(
578+
role: ChatRole.assistant,
579+
content: '[工具调用] ${tc.name}',
580+
toolCalls: [
581+
ChatToolCall(id: tc.id, name: tc.name, arguments: tc.arguments),
582+
],
583+
),
584+
)
587585
.toList();
588586

589587
state = state.copyWith(

lib/features/chat/widgets/message_bubble.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ class MessageBubble extends ConsumerWidget {
8888
onEdit: onEdit,
8989
),
9090
// 中断标记
91-
if (message.interrupted)
92-
_InterruptedTag(colorScheme: colorScheme),
91+
if (message.interrupted) _InterruptedTag(colorScheme: colorScheme),
9392
],
9493
),
9594
),
@@ -284,10 +283,7 @@ class _InterruptedTag extends StatelessWidget {
284283
const SizedBox(width: 4),
285284
Text(
286285
context.s.msgInterrupted,
287-
style: TextStyle(
288-
fontSize: 11,
289-
color: colorScheme.outline,
290-
),
286+
style: TextStyle(fontSize: 11, color: colorScheme.outline),
291287
),
292288
],
293289
),
@@ -386,10 +382,7 @@ class _StreamingBubbleState extends State<StreamingBubble>
386382
),
387383
child: widget.text.isEmpty
388384
? _buildThinkingIndicator(context, colorScheme)
389-
: MarkdownView(
390-
data: widget.text,
391-
textColor: colorScheme.onSurface,
392-
),
385+
: MarkdownView(data: widget.text, textColor: colorScheme.onSurface),
393386
),
394387
);
395388
}
@@ -415,10 +408,7 @@ class _StreamingBubbleState extends State<StreamingBubble>
415408
const SizedBox(width: 8),
416409
Text(
417410
context.s.msgThinking,
418-
style: TextStyle(
419-
color: colorScheme.onSurfaceVariant,
420-
fontSize: 13,
421-
),
411+
style: TextStyle(color: colorScheme.onSurfaceVariant, fontSize: 13),
422412
),
423413
const SizedBox(width: 6),
424414
Text(

0 commit comments

Comments
 (0)