@wendongfly/myhi 1.3.57 → 1.3.59
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/dist/chat.html +21 -3
- package/dist/index.js +1 -1
- package/dist/index.min.js +3 -3
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -137,8 +137,9 @@
|
|
|
137
137
|
#img-preview .img-remove:hover { background: #f85149; color: #fff; }
|
|
138
138
|
#input-box.focused { border-color: #58a6ff; }
|
|
139
139
|
#input-box.disabled { opacity: 0.5; pointer-events: none; }
|
|
140
|
-
#cmd-input { display: block; width: 100%; background: transparent; color: #e6edf3; border: none; padding: 0.6rem 0.75rem 0.3rem; font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 0.85rem; outline: none; resize: none; line-height: 1.
|
|
140
|
+
#cmd-input { display: block; width: 100%; background: transparent; color: #e6edf3; border: none; padding: 0.6rem 0.75rem 0.3rem; font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 0.85rem; outline: none; resize: none; line-height: 1.5; max-height: 140px; overflow-y: auto; }
|
|
141
141
|
#cmd-input::placeholder { color: #484f58; }
|
|
142
|
+
@media (pointer: coarse) { #cmd-input { font-size: 1rem; padding: 0.75rem 0.75rem 0.35rem; line-height: 1.55; } }
|
|
142
143
|
#input-toolbar { display: flex; align-items: center; padding: 0.25rem 0.4rem 0.4rem; gap: 0.15rem; }
|
|
143
144
|
#input-toolbar .spacer { flex: 1; }
|
|
144
145
|
.tb-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; color: #8b949e; cursor: pointer; transition: all 0.15s; flex-shrink: 0; }
|
|
@@ -3019,11 +3020,14 @@
|
|
|
3019
3020
|
addStatusMessage('语音上传失败: ' + e.message);
|
|
3020
3021
|
} finally {
|
|
3021
3022
|
_voicePlaceholder();
|
|
3022
|
-
cmdInput.focus();
|
|
3023
|
+
if (!_isTouchDevice()) cmdInput.focus(); // 触屏不抢焦点,避免弹键盘
|
|
3023
3024
|
}
|
|
3024
3025
|
}
|
|
3025
3026
|
|
|
3026
|
-
//
|
|
3027
|
+
// 桌面端:点击切换;触屏:长按录音松手发送,短按提示
|
|
3028
|
+
const MIN_RECORD_MS = 400;
|
|
3029
|
+
let _voiceStartTime = 0;
|
|
3030
|
+
|
|
3027
3031
|
_voiceBtn.addEventListener('click', (e) => {
|
|
3028
3032
|
if (_isTouchDevice()) return; // 触屏由 pointer 事件处理
|
|
3029
3033
|
_startVoice();
|
|
@@ -3031,11 +3035,25 @@
|
|
|
3031
3035
|
_voiceBtn.addEventListener('pointerdown', (e) => {
|
|
3032
3036
|
if (!_isTouchDevice()) return;
|
|
3033
3037
|
e.preventDefault();
|
|
3038
|
+
cmdInput.blur(); // 防止键盘弹出
|
|
3039
|
+
_voiceStartTime = Date.now();
|
|
3034
3040
|
_startVoice();
|
|
3035
3041
|
});
|
|
3036
3042
|
_voiceBtn.addEventListener('pointerup', (e) => {
|
|
3037
3043
|
if (!_isTouchDevice() || !_voiceActive) return;
|
|
3038
3044
|
e.preventDefault();
|
|
3045
|
+
const elapsed = Date.now() - _voiceStartTime;
|
|
3046
|
+
if (elapsed < MIN_RECORD_MS) {
|
|
3047
|
+
// 短按:取消录音,不上传,给提示
|
|
3048
|
+
_voiceActive = false;
|
|
3049
|
+
_voiceBtn.classList.remove('recording');
|
|
3050
|
+
_voicePlaceholder();
|
|
3051
|
+
try { _mediaRecorder?.stream?.getTracks().forEach(t => t.stop()); } catch {}
|
|
3052
|
+
try { if (_mediaRecorder?.state !== 'inactive') _mediaRecorder?.stop(); } catch {}
|
|
3053
|
+
_mediaRecorder = null;
|
|
3054
|
+
addStatusMessage('请长按 🎤 录音(按住说话,松手识别)');
|
|
3055
|
+
return;
|
|
3056
|
+
}
|
|
3039
3057
|
_stopVoice();
|
|
3040
3058
|
});
|
|
3041
3059
|
_voiceBtn.addEventListener('pointercancel', () => { if (_voiceActive) _stopVoice(); });
|