myagent-ai 1.15.99 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/web/ui/chat/chat.css
CHANGED
|
@@ -2145,12 +2145,14 @@ body.popout-mode #popoutBtn{display:none !important}
|
|
|
2145
2145
|
/* ── Input Area ── */
|
|
2146
2146
|
.input-area{
|
|
2147
2147
|
padding:10px 12px;
|
|
2148
|
+
padding-bottom: max(10px, env(safe-area-inset-bottom));
|
|
2148
2149
|
}
|
|
2149
2150
|
.input-wrapper{
|
|
2150
2151
|
max-width:100%;
|
|
2151
2152
|
}
|
|
2152
2153
|
.input-box textarea{
|
|
2153
2154
|
min-height:60px;
|
|
2155
|
+
max-height:120px;
|
|
2154
2156
|
}
|
|
2155
2157
|
|
|
2156
2158
|
/* ── Modals ── */
|
package/web/ui/chat/chat.js
CHANGED
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
];
|
|
12
12
|
var idx = 0;
|
|
13
13
|
function loadNext() {
|
|
14
|
-
if (idx >= scripts.length)
|
|
14
|
+
if (idx >= scripts.length) {
|
|
15
|
+
onAllScriptsLoaded();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
15
18
|
var s = document.createElement('script');
|
|
16
19
|
s.src = base + scripts[idx] + v;
|
|
17
20
|
s.onload = function() { idx++; loadNext(); };
|
|
@@ -20,3 +23,29 @@
|
|
|
20
23
|
}
|
|
21
24
|
loadNext();
|
|
22
25
|
})();
|
|
26
|
+
|
|
27
|
+
// ── Mobile keyboard / visualViewport handling ──
|
|
28
|
+
function onAllScriptsLoaded() {
|
|
29
|
+
if (!window.visualViewport) return;
|
|
30
|
+
|
|
31
|
+
var inputArea = document.getElementById('inputBox');
|
|
32
|
+
if (!inputArea) return;
|
|
33
|
+
|
|
34
|
+
var vv = window.visualViewport;
|
|
35
|
+
|
|
36
|
+
// When the virtual keyboard appears (viewport shrinks), the input area
|
|
37
|
+
// needs extra bottom padding so the send button stays above the keyboard.
|
|
38
|
+
function onViewportResize() {
|
|
39
|
+
var diff = window.innerHeight - vv.height;
|
|
40
|
+
if (diff > 100) {
|
|
41
|
+
// Keyboard is open — add padding equal to keyboard height
|
|
42
|
+
inputArea.style.marginBottom = diff + 'px';
|
|
43
|
+
} else {
|
|
44
|
+
// Keyboard is closed
|
|
45
|
+
inputArea.style.marginBottom = '0px';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
vv.addEventListener('resize', onViewportResize);
|
|
50
|
+
vv.addEventListener('scroll', onViewportResize);
|
|
51
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
|
6
6
|
<title>MyAgent - AI 助手</title>
|
|
7
7
|
<link rel="stylesheet" href="chat.css?v=7">
|
|
8
8
|
</head>
|
package/web/ui/chat/chat_main.js
CHANGED
|
@@ -4520,7 +4520,24 @@ var VoiceInput = {
|
|
|
4520
4520
|
this._processAudio();
|
|
4521
4521
|
},
|
|
4522
4522
|
|
|
4523
|
-
/** 清理音频流
|
|
4523
|
+
/** 清理音频流 */
|
|
4524
|
+
_cleanupStream: function() {
|
|
4525
|
+
// 断开 ScriptProcessor
|
|
4526
|
+
if (this._scriptProcessor) {
|
|
4527
|
+
try { this._scriptProcessor.disconnect(); } catch(e) {}
|
|
4528
|
+
this._scriptProcessor = null;
|
|
4529
|
+
}
|
|
4530
|
+
// 关闭 AudioContext
|
|
4531
|
+
if (this._audioContext && this._audioContext.state !== 'closed') {
|
|
4532
|
+
try { this._audioContext.close(); } catch(e) {}
|
|
4533
|
+
this._audioContext = null;
|
|
4534
|
+
}
|
|
4535
|
+
// 停止麦克风流
|
|
4536
|
+
if (this._audioStream) {
|
|
4537
|
+
this._audioStream.getTracks().forEach(function(t) { t.stop(); });
|
|
4538
|
+
this._audioStream = null;
|
|
4539
|
+
}
|
|
4540
|
+
},
|
|
4524
4541
|
|
|
4525
4542
|
/** 将 PCM Float32 样本编码为 WAV Blob(16kHz, 单声道, 16bit) */
|
|
4526
4543
|
_encodeWav: function(samples, sampleRate) {
|