feat: write the UI in English, select only conversation content
- source strings are English again; Chinese comes from lib/l10n/zh.dart through tr()/trArgs() and AppText, and a language without a table (Spanish, ...) reads English instead of Chinese - server and user data (titles, messages, file names, notes, task names) is drawn with plain Text, so it is never looked up in the table - SelectionArea moved from the whole message list to the messages, the answer text, an opened tool call's details and the turn footer; status lines and folded tool rows no longer start a selection - a message the transcript does not know (its start event was lost while the stream was down) fetches the tail once, so a turn continued from another client comes in with its prompt - bump to 0.5.3
This commit is contained in:
1 parent
7b5bccf28f
commit
511c3b006b
43 files changed
+1620
-1791
No files matched your search
+13
-13
@@ -133,11 +133,11 @@ class RelayTunnel {
|
||||
try {
|
||||
decoded = jsonDecode(utf8.decode(payload));
|
||||
} catch (_) {
|
||||
finish(error: RelayTunnelException(tr('响应头无效')));
|
||||
finish(error: RelayTunnelException(tr('Invalid response headers')));
|
||||
return;
|
||||
}
|
||||
if (decoded is! Map) {
|
||||
finish(error: RelayTunnelException(tr('响应头无效')));
|
||||
finish(error: RelayTunnelException(tr('Invalid response headers')));
|
||||
return;
|
||||
}
|
||||
final status = (decoded['status'] as num?)?.toInt() ?? 0;
|
||||
@@ -162,7 +162,7 @@ class RelayTunnel {
|
||||
controller.close();
|
||||
break;
|
||||
case RelayFrameType.streamAbort:
|
||||
var reason = tr('传输被中断');
|
||||
var reason = tr('Transfer interrupted');
|
||||
try {
|
||||
final decoded = jsonDecode(utf8.decode(payload));
|
||||
if (decoded is Map && decoded['reason'] is String) {
|
||||
@@ -269,7 +269,7 @@ class RelayTunnel {
|
||||
ws = await WebSocket.connect(uri.toString(), customClient: _http)
|
||||
.timeout(_connectTimeout);
|
||||
} catch (error) {
|
||||
throw RelayTunnelException(trArgs('无法连接 Relay:{0}', [error]));
|
||||
throw RelayTunnelException(trArgs('Could not connect to the relay: {0}', [error]));
|
||||
}
|
||||
final channel = _RelayChannel(ws);
|
||||
final ready = Completer<void>();
|
||||
@@ -326,7 +326,7 @@ class RelayTunnel {
|
||||
deadline?.cancel();
|
||||
ready.complete();
|
||||
} catch (error) {
|
||||
closeWith(RelayTunnelException(trArgs('密钥协商失败:{0}', [error])));
|
||||
closeWith(RelayTunnelException(trArgs('Key exchange failed: {0}', [error])));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -334,7 +334,7 @@ class RelayTunnel {
|
||||
// After the channel is up the host may repeat `ready` for a retried
|
||||
// hello; anything else plaintext is a protocol violation.
|
||||
if (raw.contains('"ready"')) return;
|
||||
closeWith(RelayTunnelException(tr('握手后收到明文帧')));
|
||||
closeWith(RelayTunnelException(tr('Received a plaintext frame after the handshake')));
|
||||
return;
|
||||
}
|
||||
if (raw is! List<int>) return;
|
||||
@@ -344,24 +344,24 @@ class RelayTunnel {
|
||||
final plaintext = channel.decryptor.decrypt(Uint8List.fromList(raw));
|
||||
channel.handlePlaintext(plaintext);
|
||||
} catch (error) {
|
||||
closeWith(RelayTunnelException(trArgs('解密失败:{0}', [error])));
|
||||
closeWith(RelayTunnelException(trArgs('Decryption failed: {0}', [error])));
|
||||
}
|
||||
}
|
||||
|
||||
subscription = ws.listen(
|
||||
onData,
|
||||
onError: (Object error) => closeWith(RelayTunnelException(trArgs('Relay 连接出错:{0}', [error]))),
|
||||
onError: (Object error) => closeWith(RelayTunnelException(trArgs('Relay connection error: {0}', [error]))),
|
||||
onDone: () {
|
||||
if (!finished) {
|
||||
closeWith(RelayTunnelException(trArgs(
|
||||
'Relay 连接已关闭({0} {1})',
|
||||
'Relay connection closed ({0} {1})',
|
||||
[ws.closeCode ?? '-', ws.closeReason ?? ''])));
|
||||
}
|
||||
},
|
||||
cancelOnError: true,
|
||||
);
|
||||
channel.onClosed = () =>
|
||||
closeWith(RelayTunnelException(tr('Relay 连接已关闭')));
|
||||
closeWith(RelayTunnelException(tr('Relay connection closed')));
|
||||
|
||||
void sendHello() {
|
||||
if (finished) return;
|
||||
@@ -373,13 +373,13 @@ class RelayTunnel {
|
||||
sendHello();
|
||||
helloTimer = Timer.periodic(const Duration(seconds: 1), (_) => sendHello());
|
||||
deadline = Timer(_handshakeTimeout, () {
|
||||
closeWith(RelayTunnelException(tr('Relay 握手超时')));
|
||||
closeWith(RelayTunnelException(tr('Relay handshake timed out')));
|
||||
});
|
||||
|
||||
await ready.future;
|
||||
if (channel.dead) {
|
||||
throw RelayTunnelException(trArgs(
|
||||
'Relay 连接已关闭({0} {1})',
|
||||
'Relay connection closed ({0} {1})',
|
||||
[ws.closeCode ?? '-', ws.closeReason ?? '']));
|
||||
}
|
||||
channel.startKeepAlive();
|
||||
@@ -604,7 +604,7 @@ class _RelaySocket implements TransportSocket {
|
||||
_finish();
|
||||
break;
|
||||
case RelayFrameType.streamAbort:
|
||||
_finish(error: RelayTunnelException(tr('WebSocket 子流被中断')));
|
||||
_finish(error: RelayTunnelException(tr('WebSocket substream interrupted')));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user