@wendongfly/myhi 1.3.69 → 1.3.71
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 +28 -11
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -147,6 +147,8 @@
|
|
|
147
147
|
.tb-btn:active { transform: scale(0.92); }
|
|
148
148
|
.tb-btn.active { color: #58a6ff; }
|
|
149
149
|
.tb-btn.recording { color: #f85149; animation: pulse 1s infinite; }
|
|
150
|
+
@keyframes va-ring { 0% { box-shadow: 0 0 0 0 rgba(218,54,51,0.6); } 70% { box-shadow: 0 0 0 12px rgba(218,54,51,0); } 100% { box-shadow: 0 0 0 0 rgba(218,54,51,0); } }
|
|
151
|
+
.va-btn-rec { animation: va-ring 1s ease-out infinite !important; }
|
|
150
152
|
.tb-btn svg { width: 18px; height: 18px; }
|
|
151
153
|
#send-btn { color: #3fb950; }
|
|
152
154
|
#send-btn:hover { background: rgba(63,185,80,0.12); color: #3fb950; }
|
|
@@ -604,10 +606,14 @@
|
|
|
604
606
|
</button>
|
|
605
607
|
<div id="va-status" style="text-align:center;font-size:0.78rem;color:#8b949e;min-height:1.3em;margin-bottom:0.2rem"></div>
|
|
606
608
|
<div style="display:flex;gap:0.4rem;padding:0 0.2rem">
|
|
609
|
+
<button id="va-direct-btn" class="action-sheet-cancel" onclick="vaDirectSend()"
|
|
610
|
+
style="flex:1;background:#238636;color:#fff;font-weight:600;margin-bottom:0">直接发送</button>
|
|
607
611
|
<button id="va-organize-btn" class="action-sheet-cancel" onclick="vaOrganize()"
|
|
608
612
|
style="flex:1;background:#7c3aed;color:#fff;font-weight:600;margin-bottom:0">整理成需求</button>
|
|
613
|
+
</div>
|
|
614
|
+
<div id="va-result-action" style="display:none;padding:0 0.2rem">
|
|
609
615
|
<button id="va-send-btn" class="action-sheet-cancel" onclick="vaSend()"
|
|
610
|
-
style="
|
|
616
|
+
style="background:#1f6feb;color:#fff;font-weight:600;margin-bottom:0">发送到对话</button>
|
|
611
617
|
</div>
|
|
612
618
|
<button class="action-sheet-cancel" onclick="closeVaSheet()" style="margin-top:0.4rem">关闭</button>
|
|
613
619
|
</div>
|
|
@@ -3119,7 +3125,10 @@
|
|
|
3119
3125
|
const _vaBtn = document.getElementById('va-record-btn');
|
|
3120
3126
|
const _vaStatusEl = document.getElementById('va-status');
|
|
3121
3127
|
|
|
3122
|
-
function _vaSetStatus(t) {
|
|
3128
|
+
function _vaSetStatus(t, color) {
|
|
3129
|
+
_vaStatusEl.textContent = t || '';
|
|
3130
|
+
_vaStatusEl.style.color = color || '#8b949e';
|
|
3131
|
+
}
|
|
3123
3132
|
|
|
3124
3133
|
function _vaIdleLabel() { return _isTouchDevice() ? '按住说话' : '点击开始录音'; }
|
|
3125
3134
|
function _vaActiveLabel() { return _isTouchDevice() ? '松手停止' : '点击停止录音'; }
|
|
@@ -3172,7 +3181,8 @@
|
|
|
3172
3181
|
_vaActive = true;
|
|
3173
3182
|
_vaBtn.textContent = _vaActiveLabel();
|
|
3174
3183
|
_vaBtn.style.background = '#da3633';
|
|
3175
|
-
|
|
3184
|
+
_vaBtn.classList.add('va-btn-rec');
|
|
3185
|
+
_vaSetStatus('● 录音中', '#f85149');
|
|
3176
3186
|
}
|
|
3177
3187
|
|
|
3178
3188
|
function _vaStop() {
|
|
@@ -3180,7 +3190,8 @@
|
|
|
3180
3190
|
_vaActive = false;
|
|
3181
3191
|
_vaBtn.textContent = _vaIdleLabel();
|
|
3182
3192
|
_vaBtn.style.background = '#1f6feb';
|
|
3183
|
-
|
|
3193
|
+
_vaBtn.classList.remove('va-btn-rec');
|
|
3194
|
+
_vaSetStatus('识别中...', '#d29922');
|
|
3184
3195
|
_vaMR.stop();
|
|
3185
3196
|
}
|
|
3186
3197
|
|
|
@@ -3191,16 +3202,16 @@
|
|
|
3191
3202
|
const resp = await fetch(`/api/voice-transcribe?sessionId=${SESSION_ID}`, { method: 'POST', body: form });
|
|
3192
3203
|
const data = await resp.json();
|
|
3193
3204
|
if (resp.status === 503) {
|
|
3194
|
-
_vaSetStatus('ASR
|
|
3205
|
+
_vaSetStatus('ASR 服务未配置,请在设置中填写语音识别地址', '#f85149');
|
|
3195
3206
|
} else if (data.text) {
|
|
3196
3207
|
_vaLines.push(data.text);
|
|
3197
3208
|
_vaRender();
|
|
3198
|
-
_vaSetStatus(
|
|
3209
|
+
_vaSetStatus(`✓ 第 ${_vaLines.length} 段已录入`, '#3fb950');
|
|
3199
3210
|
} else {
|
|
3200
|
-
_vaSetStatus('未识别到内容,请重试');
|
|
3211
|
+
_vaSetStatus('未识别到内容,请重试', '#d29922');
|
|
3201
3212
|
}
|
|
3202
3213
|
} catch (e) {
|
|
3203
|
-
_vaSetStatus('上传失败: ' + e.message);
|
|
3214
|
+
_vaSetStatus('上传失败: ' + e.message, '#f85149');
|
|
3204
3215
|
}
|
|
3205
3216
|
}
|
|
3206
3217
|
|
|
@@ -3217,11 +3228,17 @@
|
|
|
3217
3228
|
window.vaClear = function() {
|
|
3218
3229
|
_vaLines = [];
|
|
3219
3230
|
document.getElementById('va-result-wrap').style.display = 'none';
|
|
3220
|
-
document.getElementById('va-
|
|
3221
|
-
document.getElementById('va-organize-btn').style.display = '';
|
|
3231
|
+
document.getElementById('va-result-action').style.display = 'none';
|
|
3222
3232
|
_vaRender();
|
|
3223
3233
|
_vaSetStatus('');
|
|
3224
3234
|
};
|
|
3235
|
+
|
|
3236
|
+
window.vaDirectSend = function() {
|
|
3237
|
+
if (_vaLines.length === 0) { _vaSetStatus('请先录入语音内容'); return; }
|
|
3238
|
+
cmdInput.value = _vaLines.join('\n');
|
|
3239
|
+
window.closeVaSheet();
|
|
3240
|
+
if (!_isTouchDevice()) cmdInput.focus();
|
|
3241
|
+
};
|
|
3225
3242
|
window.vaOrganize = async function() {
|
|
3226
3243
|
if (_vaLines.length === 0) { _vaSetStatus('请先录入语音内容'); return; }
|
|
3227
3244
|
const btn = document.getElementById('va-organize-btn');
|
|
@@ -3237,7 +3254,7 @@
|
|
|
3237
3254
|
if (data.requirement) {
|
|
3238
3255
|
document.getElementById('va-result').value = data.requirement;
|
|
3239
3256
|
document.getElementById('va-result-wrap').style.display = '';
|
|
3240
|
-
document.getElementById('va-
|
|
3257
|
+
document.getElementById('va-result-action').style.display = '';
|
|
3241
3258
|
_vaSetStatus('整理完成,可编辑后点"发送到对话"');
|
|
3242
3259
|
} else {
|
|
3243
3260
|
_vaSetStatus('整理失败: ' + (data.error || '未知错误'));
|