Compare commits
6 Commits
d6c7ca7aec
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d0198b17a | |||
| 607c09abe7 | |||
| 736c2feb4f | |||
| 8161e7512b | |||
| 99b82810c2 | |||
| d2e650a434 |
@@ -3,19 +3,7 @@
|
|||||||
"clientId": "6",
|
"clientId": "6",
|
||||||
"appId": "wx5e79df5996572539",
|
"appId": "wx5e79df5996572539",
|
||||||
"name": "智念",
|
"name": "智念",
|
||||||
"placeholder": "快告诉智念您在想什么~",
|
|
||||||
"loginDesc": "您好,欢迎来到智念科技",
|
|
||||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png",
|
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png",
|
||||||
"ipLargeImage": "https://oss.nianxx.cn/mp/static/version_101/zn/zn_large.png",
|
|
||||||
"ipLargeImageWidth": 395,
|
|
||||||
"ipLargeImageHeight": 335,
|
|
||||||
"ipLargeTotalFrames": 71,
|
|
||||||
"ipLargeColumns": 1,
|
|
||||||
"ipSmallImage": "https://oss.nianxx.cn/mp/static/version_101/dh/dh_small.png",
|
|
||||||
"ipSmallImageWidth": 128,
|
|
||||||
"ipSmallImageHeight": 128,
|
|
||||||
"ipSmallTotalFrames": 117,
|
|
||||||
"ipSmallColumns": 1,
|
|
||||||
"theme": {
|
"theme": {
|
||||||
"theme-color-800": "#0B7034",
|
"theme-color-800": "#0B7034",
|
||||||
"theme-color-700": "#0B5C2D",
|
"theme-color-700": "#0B5C2D",
|
||||||
@@ -28,19 +16,7 @@
|
|||||||
"clientId": "11",
|
"clientId": "11",
|
||||||
"appId": "wx6fcf7b3db3deee6c",
|
"appId": "wx6fcf7b3db3deee6c",
|
||||||
"name": "智念助手",
|
"name": "智念助手",
|
||||||
"placeholder": "快告诉智念助手您在想什么~",
|
|
||||||
"loginDesc": "您好,欢迎来到智念科技",
|
|
||||||
"logo": "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/znjqzs.png",
|
"logo": "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/znjqzs.png",
|
||||||
"ipLargeImage": "https://oss.nianxx.cn/mp/static/version_101/zn/zn_large.png",
|
|
||||||
"ipLargeImageWidth": 395,
|
|
||||||
"ipLargeImageHeight": 335,
|
|
||||||
"ipLargeTotalFrames": 71,
|
|
||||||
"ipLargeColumns": 1,
|
|
||||||
"ipSmallImage": "https://oss.nianxx.cn/mp/static/version_101/dh/dh_small.png",
|
|
||||||
"ipSmallImageWidth": 128,
|
|
||||||
"ipSmallImageHeight": 128,
|
|
||||||
"ipSmallTotalFrames": 117,
|
|
||||||
"ipSmallColumns": 1,
|
|
||||||
"theme": {
|
"theme": {
|
||||||
"theme-color-800": "#174BB6",
|
"theme-color-800": "#174BB6",
|
||||||
"theme-color-700": "#145EE1",
|
"theme-color-700": "#145EE1",
|
||||||
@@ -53,19 +29,7 @@
|
|||||||
"clientId": "2",
|
"clientId": "2",
|
||||||
"appId": "wx23f86d809ae80259",
|
"appId": "wx23f86d809ae80259",
|
||||||
"name": "朵朵",
|
"name": "朵朵",
|
||||||
"placeholder": "快告诉朵朵您在想什么~",
|
|
||||||
"loginDesc": "您好,欢迎来到朵花温泉",
|
|
||||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png",
|
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png",
|
||||||
"ipLargeImage": "https://oss.nianxx.cn/mp/static/version_101/dh/dh_large.png",
|
|
||||||
"ipLargeImageWidth": 263,
|
|
||||||
"ipLargeImageHeight": 210,
|
|
||||||
"ipLargeTotalFrames": 147,
|
|
||||||
"ipLargeColumns": 1,
|
|
||||||
"ipSmallImage": "https://oss.nianxx.cn/mp/static/version_101/dh/dh_small.png",
|
|
||||||
"ipSmallImageWidth": 128,
|
|
||||||
"ipSmallImageHeight": 128,
|
|
||||||
"ipSmallTotalFrames": 117,
|
|
||||||
"ipSmallColumns": 1,
|
|
||||||
"theme": {
|
"theme": {
|
||||||
"theme-color-800": "#0B7034",
|
"theme-color-800": "#0B7034",
|
||||||
"theme-color-700": "#0B5C2D",
|
"theme-color-700": "#0B5C2D",
|
||||||
@@ -78,19 +42,7 @@
|
|||||||
"clientId": "4",
|
"clientId": "4",
|
||||||
"appId": "wx0be424e1d22065a9",
|
"appId": "wx0be424e1d22065a9",
|
||||||
"name": "沐沐",
|
"name": "沐沐",
|
||||||
"placeholder": "快告诉沐沐您在想什么~",
|
|
||||||
"loginDesc": "您好,欢迎来到天沐温泉",
|
|
||||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png",
|
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png",
|
||||||
"ipLargeImage": "https://oss.nianxx.cn/mp/static/version_101/tm/tm_large.png",
|
|
||||||
"ipLargeImageWidth": 395,
|
|
||||||
"ipLargeImageHeight": 335,
|
|
||||||
"ipLargeTotalFrames": 71,
|
|
||||||
"ipLargeColumns": 1,
|
|
||||||
"ipSmallImage": "https://oss.nianxx.cn/mp/static/version_101/tm/tm_small.png",
|
|
||||||
"ipSmallImageWidth": 128,
|
|
||||||
"ipSmallImageHeight": 128,
|
|
||||||
"ipSmallTotalFrames": 148,
|
|
||||||
"ipSmallColumns": 1,
|
|
||||||
"theme": {
|
"theme": {
|
||||||
"theme-color-800": "#174BB6",
|
"theme-color-800": "#174BB6",
|
||||||
"theme-color-700": "#145EE1",
|
"theme-color-700": "#145EE1",
|
||||||
|
|||||||
376
package-lock.json
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"appid": "wx6fcf7b3db3deee6c",
|
"appid": "wx5e79df5996572539",
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "3.8.10",
|
"libVersion": "3.8.10",
|
||||||
"packOptions": {
|
"packOptions": {
|
||||||
|
|||||||
@@ -19,24 +19,18 @@
|
|||||||
"clientId": "2",
|
"clientId": "2",
|
||||||
"appId": "wx5e79df5996572539",
|
"appId": "wx5e79df5996572539",
|
||||||
"name": "智念",
|
"name": "智念",
|
||||||
"placeholder": "快告诉智念您在想什么~",
|
|
||||||
"loginDesc": "您好,欢迎来到智念科技",
|
|
||||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
|
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
|
||||||
},
|
},
|
||||||
"duohua": {
|
"duohua": {
|
||||||
"clientId": "2",
|
"clientId": "2",
|
||||||
"appId": "wx23f86d809ae80259",
|
"appId": "wx23f86d809ae80259",
|
||||||
"name": "朵花",
|
"name": "朵花",
|
||||||
"placeholder": "快告诉朵朵您在想什么~",
|
|
||||||
"loginDesc": "您好,欢迎来到朵花温泉",
|
|
||||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
|
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
|
||||||
},
|
},
|
||||||
"tianmu": {
|
"tianmu": {
|
||||||
"clientId": "4",
|
"clientId": "4",
|
||||||
"appId": "wx0be424e1d22065a9",
|
"appId": "wx0be424e1d22065a9",
|
||||||
"name": "天沐",
|
"name": "天沐",
|
||||||
"placeholder": "快告诉沐沐您在想什么~",
|
|
||||||
"loginDesc": "您好,欢迎来到天沐温泉",
|
|
||||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png"
|
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,8 +155,6 @@ A: 在 `client-configs.json` 中添加新的客户端配置:
|
|||||||
"clientId": "客户端ID",
|
"clientId": "客户端ID",
|
||||||
"appId": "微信小程序AppID",
|
"appId": "微信小程序AppID",
|
||||||
"name": "客户端显示名称",
|
"name": "客户端显示名称",
|
||||||
"placeholder": "输入框占位符文本",
|
|
||||||
"loginDesc": "登录页面描述文本",
|
|
||||||
"logo": "@/pages/login/images/logo.png",
|
"logo": "@/pages/login/images/logo.png",
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.1 KiB |
@@ -1,5 +1,5 @@
|
|||||||
.command-wrapper {
|
.command-wrapper {
|
||||||
background-color: #00a6ff;
|
background-color: $theme-color-500;
|
||||||
border-radius: 20px 4px 20px 20px;
|
border-radius: 20px 4px 20px 20px;
|
||||||
padding: 8px 24px;
|
padding: 8px 24px;
|
||||||
width: max-content;
|
width: max-content;
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ const addForm = () => {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
border-left: 6rpx solid #00a6ff;
|
border-left: 6rpx solid $theme-color-500;
|
||||||
padding-left: 16rpx;
|
padding-left: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ const addForm = () => {
|
|||||||
.add-btn {
|
.add-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
background: #00a6ff;
|
background: $theme-color-500;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="form-wrapper">
|
<view class="form-wrapper">
|
||||||
<view class="form-header">
|
<view class="form-header">
|
||||||
<uni-icons class="minus" color="#00A6FF" size="22" type="minus" />
|
<uni-icons class="minus uni-color" color="opacity" size="22" type="minus" />
|
||||||
<text class="form-title">{{ title }}</text>
|
<text class="form-title">{{ title }}</text>
|
||||||
<uni-icons
|
<uni-icons
|
||||||
v-if="showDeleteIcon"
|
v-if="showDeleteIcon"
|
||||||
class="delete"
|
class="delete uni-color"
|
||||||
color="#00A6FF"
|
color="opacity"
|
||||||
size="22"
|
size="22"
|
||||||
type="trash"
|
type="trash"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ $form-transition: all 0.2s ease;
|
|||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
|
|
||||||
|
.uni-color {
|
||||||
|
color: $theme-color-500;
|
||||||
|
}
|
||||||
|
|
||||||
.minus,
|
.minus,
|
||||||
.delete {
|
.delete {
|
||||||
height: 22px;
|
height: 22px;
|
||||||
@@ -50,7 +54,7 @@ $form-transition: all 0.2s ease;
|
|||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
font-size: $uni-font-size-lg;
|
font-size: $uni-font-size-lg;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: $form-primary-color;
|
color: $theme-color-500;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -110,7 +114,7 @@ $form-transition: all 0.2s ease;
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
border-bottom-color: $form-primary-color;
|
border-bottom-color: $theme-color-500;
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|||||||
@@ -48,6 +48,6 @@
|
|||||||
);
|
);
|
||||||
font-size: $uni-font-size-sm;
|
font-size: $uni-font-size-sm;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #00a6ff;
|
color: $theme-color-500;
|
||||||
border-radius: $uni-border-radius-50px;
|
border-radius: $uni-border-radius-50px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ defineExpose({
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #00a6ff;
|
background-color: $theme-color-500;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
border-radius: $uni-border-radius-50px;
|
border-radius: $uni-border-radius-50px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,6 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
font-size: $uni-font-size-sm;
|
font-size: $uni-font-size-sm;
|
||||||
color: #00a6ff;
|
color: $theme-color-500;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import rawConfigs from "../../client-configs.json" with { type: "json" };
|
|||||||
export const CLIENT_CONFIGS = rawConfigs;
|
export const CLIENT_CONFIGS = rawConfigs;
|
||||||
|
|
||||||
// 获取当前用户端配置
|
// 获取当前用户端配置
|
||||||
export const getCurrentConfig = () => CLIENT_CONFIGS.nianhelper;
|
export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian;
|
||||||
export const clientId = getCurrentConfig().clientId;
|
export const clientId = getCurrentConfig().clientId;
|
||||||
export const appId = getCurrentConfig().appId;
|
export const appId = getCurrentConfig().appId;
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
朵花:wx23f86d809ae80259
|
朵花:wx23f86d809ae80259
|
||||||
*/
|
*/
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid": "wx6fcf7b3db3deee6c",
|
"appid": "wx5e79df5996572539",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"minified": true
|
"minified": true
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/long-answer/index",
|
"path": "pages/ChatMain/ChatLongAnswer/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
/>
|
/>
|
||||||
<ChatMarkdown :key="textKey" :text="processedText" />
|
<ChatMarkdown :key="textKey" :text="processedText" />
|
||||||
<DotLoading v-if="isLoading" />
|
<ChatLoading v-if="isLoading" />
|
||||||
</view>
|
</view>
|
||||||
<slot name="content"></slot>
|
<slot name="content"></slot>
|
||||||
</view>
|
</view>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps, computed, ref, watch } from "vue";
|
import { defineProps, computed, ref, watch } from "vue";
|
||||||
import ChatMarkdown from "../ChatMarkdown/index.vue";
|
import ChatMarkdown from "../ChatMarkdown/index.vue";
|
||||||
import DotLoading from "../../loading/DotLoading.vue";
|
import ChatLoading from "../ChatLoading/index.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
text: {
|
text: {
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch, nextTick, onMounted, defineExpose } from "vue";
|
import { ref, computed, watch, nextTick, onMounted, defineExpose, onUnmounted } from "vue";
|
||||||
import RecordingWaveBtn from "@/components/Speech/RecordingWaveBtn.vue";
|
import RecordingWaveBtn from "@/components/Speech/RecordingWaveBtn.vue";
|
||||||
import { getCurrentConfig } from "@/constant/base";
|
import { getCurrentConfig } from "@/constant/base";
|
||||||
|
|
||||||
@@ -97,12 +97,41 @@ const emit = defineEmits([
|
|||||||
|
|
||||||
const textareaRef = ref(null);
|
const textareaRef = ref(null);
|
||||||
const recordingWaveBtnRef = ref(null);
|
const recordingWaveBtnRef = ref(null);
|
||||||
const placeholder = computed(() => getCurrentConfig().placeholder);
|
const placeholder = computed(() => {
|
||||||
|
const config = getCurrentConfig();
|
||||||
|
return `快告诉${config.name}您在想什么~`;
|
||||||
|
});
|
||||||
const inputMessage = ref(props.modelValue || "");
|
const inputMessage = ref(props.modelValue || "");
|
||||||
const isFocused = ref(false);
|
const isFocused = ref(false);
|
||||||
const keyboardHeight = ref(0);
|
const keyboardHeight = ref(0);
|
||||||
const isVoiceMode = ref(false);
|
const isVoiceMode = ref(false);
|
||||||
const visibleWaveBtn = ref(false);
|
const visibleWaveBtn = ref(false);
|
||||||
|
const isRecording = ref(false);
|
||||||
|
let watchDogTimer = null;
|
||||||
|
|
||||||
|
const resetUI = () => {
|
||||||
|
isRecording.value = false;
|
||||||
|
visibleWaveBtn.value = false;
|
||||||
|
try {
|
||||||
|
if (recordingWaveBtnRef.value) {
|
||||||
|
recordingWaveBtnRef.value.stopAnimation();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("resetUI stopAnimation error", e);
|
||||||
|
}
|
||||||
|
if (watchDogTimer) {
|
||||||
|
clearTimeout(watchDogTimer);
|
||||||
|
watchDogTimer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const startWatchDog = (timeout = 10000) => {
|
||||||
|
if (watchDogTimer) clearTimeout(watchDogTimer);
|
||||||
|
watchDogTimer = setTimeout(() => {
|
||||||
|
console.warn("recording watchdog triggered, forcing UI reset");
|
||||||
|
resetUI();
|
||||||
|
}, timeout);
|
||||||
|
};
|
||||||
|
|
||||||
// 保持和父组件同步
|
// 保持和父组件同步
|
||||||
watch(
|
watch(
|
||||||
@@ -127,8 +156,9 @@ const toggleVoiceMode = () => {
|
|||||||
|
|
||||||
// 处理语音按钮长按开始
|
// 处理语音按钮长按开始
|
||||||
const handleVoiceTouchStart = () => {
|
const handleVoiceTouchStart = () => {
|
||||||
|
try {
|
||||||
manager.start({ lang: "zh_CN" });
|
manager.start({ lang: "zh_CN" });
|
||||||
|
isRecording.value = true;
|
||||||
visibleWaveBtn.value = true;
|
visibleWaveBtn.value = true;
|
||||||
|
|
||||||
// 启动音频条动画
|
// 启动音频条动画
|
||||||
@@ -137,32 +167,54 @@ const handleVoiceTouchStart = () => {
|
|||||||
recordingWaveBtnRef.value.startAnimation();
|
recordingWaveBtnRef.value.startAnimation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
startWatchDog(10000);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("record start error:", err);
|
||||||
|
// 保底清理
|
||||||
|
resetUI();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理语音按钮长按结束
|
// 处理语音按钮长按结束
|
||||||
const handleVoiceTouchEnd = () => {
|
const handleVoiceTouchEnd = () => {
|
||||||
manager.stop();
|
// 如果本地状态不是录音中,也确保 UI 恢复
|
||||||
|
if (!isRecording.value) {
|
||||||
// 停止音频条动画
|
|
||||||
if (recordingWaveBtnRef.value) {
|
if (recordingWaveBtnRef.value) {
|
||||||
recordingWaveBtnRef.value.stopAnimation();
|
recordingWaveBtnRef.value.stopAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
visibleWaveBtn.value = false;
|
visibleWaveBtn.value = false;
|
||||||
|
if (watchDogTimer) {
|
||||||
|
clearTimeout(watchDogTimer);
|
||||||
|
watchDogTimer = null;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
manager.stop();
|
||||||
|
} catch (err) {
|
||||||
|
console.error("record stop error:", err);
|
||||||
|
} finally {
|
||||||
|
// 无论 stop 是否抛错,都保证 UI 恢复
|
||||||
|
resetUI();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理发送原语音
|
// 处理发送原语音
|
||||||
const initRecord = () => {
|
const initRecord = () => {
|
||||||
manager.onRecognize = (res) => {
|
manager.onRecognize = (res) => {
|
||||||
let text = res.result;
|
let text = res.result || "";
|
||||||
inputMessage.value = text;
|
inputMessage.value = text;
|
||||||
};
|
};
|
||||||
// 识别结束事件
|
// 识别结束事件
|
||||||
manager.onStop = (res) => {
|
manager.onStop = (res) => {
|
||||||
console.log(res, 37);
|
console.log(res, 37);
|
||||||
let text = res.result;
|
let text = (res && res.result) || "";
|
||||||
|
|
||||||
if (text == "") {
|
// 保证 UI 恢复(防止未走 handleVoiceTouchEnd)
|
||||||
|
resetUI();
|
||||||
|
|
||||||
|
if (text === "") {
|
||||||
console.log("没有说话");
|
console.log("没有说话");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -171,6 +223,12 @@ const initRecord = () => {
|
|||||||
// 在语音识别完成后发送消息
|
// 在语音识别完成后发送消息
|
||||||
emit("send", text);
|
emit("send", text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 错误处理,确保 UI 重置
|
||||||
|
manager.onError = (err) => {
|
||||||
|
console.error("record manager error", err);
|
||||||
|
resetUI();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 监听键盘高度变化
|
// 监听键盘高度变化
|
||||||
@@ -188,6 +246,18 @@ onMounted(() => {
|
|||||||
initRecord();
|
initRecord();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
try {
|
||||||
|
manager.stop && manager.stop();
|
||||||
|
} catch (e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
manager.onRecognize = null;
|
||||||
|
manager.onStop = null;
|
||||||
|
manager.onError = null;
|
||||||
|
resetUI();
|
||||||
|
});
|
||||||
|
|
||||||
const sendMessage = () => {
|
const sendMessage = () => {
|
||||||
if (props.isSessionActive) {
|
if (props.isSessionActive) {
|
||||||
// 如果会话进行中,调用停止请求函数
|
// 如果会话进行中,调用停止请求函数
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||||
import ChatMarkdown from "../index/components/chat/ChatMarkdown/index.vue";
|
import ChatMarkdown from "../ChatMarkdown/index.vue";
|
||||||
import { defineProps, ref, nextTick } from "vue";
|
import { defineProps, ref, nextTick } from "vue";
|
||||||
import { onLoad, onUnload } from "@dcloudio/uni-app";
|
import { onLoad, onUnload } from "@dcloudio/uni-app";
|
||||||
import StreamManager from "@/utils/StreamManager.js";
|
import StreamManager from "@/utils/StreamManager.js";
|
||||||
@@ -185,6 +185,7 @@ import {
|
|||||||
NOTICE_EVENT_LOGIN_SUCCESS,
|
NOTICE_EVENT_LOGIN_SUCCESS,
|
||||||
} from "@/constant/constant";
|
} from "@/constant/constant";
|
||||||
import { MessageRole, MessageType, CompName, Command } from "@/model/ChatModel";
|
import { MessageRole, MessageType, CompName, Command } from "@/model/ChatModel";
|
||||||
|
|
||||||
import ChatTopWelcome from "../ChatTopWelcome/index.vue";
|
import ChatTopWelcome from "../ChatTopWelcome/index.vue";
|
||||||
import NoticeMessage from "../NoticeMessage/index.vue";
|
import NoticeMessage from "../NoticeMessage/index.vue";
|
||||||
import ChatTopNavBar from "../ChatTopNavBar/index.vue";
|
import ChatTopNavBar from "../ChatTopNavBar/index.vue";
|
||||||
@@ -193,15 +194,17 @@ import ChatCardMine from "../ChatCardMine/index.vue";
|
|||||||
import ChatCardOther from "../ChatCardOther/index.vue";
|
import ChatCardOther from "../ChatCardOther/index.vue";
|
||||||
import ChatQuickAccess from "../ChatQuickAccess/index.vue";
|
import ChatQuickAccess from "../ChatQuickAccess/index.vue";
|
||||||
import ChatInputArea from "../ChatInputArea/index.vue";
|
import ChatInputArea from "../ChatInputArea/index.vue";
|
||||||
import QuickBookingComponent from "../../module/QuickBookingComponent/index.vue";
|
|
||||||
import DiscoveryCardComponent from "../../module/DiscoveryCardComponent/index.vue";
|
import QuickBookingComponent from "../../ChatModule/QuickBookingComponent/index.vue";
|
||||||
import ActivityListComponent from "../../module/ActivityListComponent/index.vue";
|
import DiscoveryCardComponent from "../../ChatModule/DiscoveryCardComponent/index.vue";
|
||||||
import RecommendPostsComponent from "../../module/RecommendPostsComponent/index.vue";
|
import ActivityListComponent from "../../ChatModule/ActivityListComponent/index.vue";
|
||||||
import AttachListComponent from "../../module/AttachListComponent/index.vue";
|
import RecommendPostsComponent from "../../ChatModule/RecommendPostsComponent/index.vue";
|
||||||
import DetailCardCompontent from "../../module/DetailCardCompontent/index.vue";
|
import AttachListComponent from "../../ChatModule/AttachListComponent/index.vue";
|
||||||
import OpenMapComponent from "../../module/OpenMapComponent/index.vue";
|
import DetailCardCompontent from "../../ChatModule/DetailCardCompontent/index.vue";
|
||||||
import AnswerComponent from "../../module/AnswerComponent/index.vue";
|
import OpenMapComponent from "../../ChatModule/OpenMapComponent/index.vue";
|
||||||
import GeneratorPhotoComponent from "../../module/GeneratorPhotoComponent/index.vue";
|
import AnswerComponent from "../../ChatModule/AnswerComponent/index.vue";
|
||||||
|
import GeneratorPhotoComponent from "../../ChatModule/GeneratorPhotoComponent/index.vue";
|
||||||
|
|
||||||
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
||||||
import Feedback from "@/components/Feedback/index.vue";
|
import Feedback from "@/components/Feedback/index.vue";
|
||||||
import AddCarCrad from "@/components/AddCarCrad/index.vue";
|
import AddCarCrad from "@/components/AddCarCrad/index.vue";
|
||||||
@@ -212,7 +215,7 @@ import {
|
|||||||
recentConversation,
|
recentConversation,
|
||||||
} from "@/request/api/ConversationApi";
|
} from "@/request/api/ConversationApi";
|
||||||
import WebSocketManager from "@/utils/WebSocketManager";
|
import WebSocketManager from "@/utils/WebSocketManager";
|
||||||
import { ThrottleUtils, IdUtils } from "@/utils";
|
import { IdUtils } from "@/utils";
|
||||||
import { checkToken } from "@/hooks/useGoLogin";
|
import { checkToken } from "@/hooks/useGoLogin";
|
||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
import { getAccessToken } from "@/constant/token";
|
import { getAccessToken } from "@/constant/token";
|
||||||
@@ -52,16 +52,14 @@ const initPageImages = computed(() => {
|
|||||||
return props.mainPageDataModel?.initPageImages || {};
|
return props.mainPageDataModel?.initPageImages || {};
|
||||||
});
|
});
|
||||||
|
|
||||||
const config = getCurrentConfig();
|
|
||||||
|
|
||||||
const spriteStyle = computed(() => {
|
const spriteStyle = computed(() => {
|
||||||
const images = initPageImages.value;
|
const images = initPageImages.value;
|
||||||
return {
|
return {
|
||||||
ipLargeImage: images.ipLargeImage ?? config.ipLargeImage,
|
ipLargeImage: images.ipLargeImage,
|
||||||
frameWidth: images.ipLargeImageWidth ?? config.ipLargeImageWidth,
|
frameWidth: images.ipLargeImageWidth,
|
||||||
frameHeight: images.ipLargeImageHeight ?? config.ipLargeImageHeight,
|
frameHeight: images.ipLargeImageHeight,
|
||||||
totalFrames: images.ipLargeTotalFrames ?? config.ipLargeTotalFrames,
|
totalFrames: images.ipLargeTotalFrames,
|
||||||
columns: images.ipLargeColumns ?? config.ipLargeColumns,
|
columns: images.ipLargeColumns,
|
||||||
displayWidth: 158,
|
displayWidth: 158,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
@@ -14,7 +14,7 @@
|
|||||||
<!-- 超过3行时显示...提示 -->
|
<!-- 超过3行时显示...提示 -->
|
||||||
<view v-if="!finish" class="flex flex-row flex-items-center mt-8">
|
<view v-if="!finish" class="flex flex-row flex-items-center mt-8">
|
||||||
<text class="font-size-12 font-400 font-color-600">正在生成</text>
|
<text class="font-size-12 font-400 font-color-600">正在生成</text>
|
||||||
<DotLoading />
|
<ChatLoading />
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isOverflow" class="flex flex-row flex-items-center mt-8" @click="lookDetailAction">
|
<view v-if="isOverflow" class="flex flex-row flex-items-center mt-8" @click="lookDetailAction">
|
||||||
<text class="font-size-12 font-400 theme-color-500 mr-4">查看详情</text>
|
<text class="font-size-12 font-400 theme-color-500 mr-4">查看详情</text>
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps, computed, ref, watch, onBeforeUnmount } from "vue";
|
import { defineProps, computed, ref, watch, onBeforeUnmount } from "vue";
|
||||||
|
|
||||||
import ChatMarkdown from "../../chat/ChatMarkdown/index.vue";
|
import ChatMarkdown from "../../ChatMain/ChatMarkdown/index.vue";
|
||||||
import DotLoading from "../../loading/DotLoading.vue";
|
import ChatLoading from "../../ChatMain/ChatLoading/index.vue";
|
||||||
import StreamManager from '@/utils/StreamManager.js';
|
import StreamManager from '@/utils/StreamManager.js';
|
||||||
|
|
||||||
const isOverflow = ref(false)
|
const isOverflow = ref(false)
|
||||||
@@ -125,7 +125,7 @@ const lookDetailAction = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 传递 finished 参数,完成状态下不自动滚到底部
|
// 传递 finished 参数,完成状态下不自动滚到底部
|
||||||
uni.navigateTo({ url: `/pages/long-answer/index?streamId=${encodeURIComponent(streamId)}&finished=${props.finish ? '1' : '0'}` });
|
uni.navigateTo({ url: `/pages/ChatMain/ChatLongAnswer/index?streamId=${encodeURIComponent(streamId)}&finished=${props.finish ? '1' : '0'}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Before Width: | Height: | Size: 532 KiB After Width: | Height: | Size: 532 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
@@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.date-item.active {
|
.date-item.active {
|
||||||
background-color: #00a6ff;
|
background-color: $theme-color-500;
|
||||||
}
|
}
|
||||||
.date-item.active .label,
|
.date-item.active .label,
|
||||||
.date-item.active .date {
|
.date-item.active .date {
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
.confirm-btn {
|
.confirm-btn {
|
||||||
width: 160px;
|
width: 160px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
background: linear-gradient(179deg, #00a6ff 0%, #0256ff 100%);
|
background: linear-gradient(179deg, $theme-color-500 0%, $theme-color-700 100%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ import { ref, onUnmounted } from "vue";
|
|||||||
import { getUrlParams } from "@/utils/UrlParams";
|
import { getUrlParams } from "@/utils/UrlParams";
|
||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
import { checkToken } from "@/hooks/useGoLogin";
|
import { checkToken } from "@/hooks/useGoLogin";
|
||||||
import ChatMainList from "./components/chat/ChatMainList/index.vue";
|
import ChatMainList from "../ChatMain/ChatMainList/index.vue";
|
||||||
|
import MoreService from "../ChatModule/MoreService/index.vue";
|
||||||
|
import DrawerSection from "../DrawerSection/index.vue";
|
||||||
import Calender from "@/components/Calender/index.vue";
|
import Calender from "@/components/Calender/index.vue";
|
||||||
import MoreService from "./components/module/MoreService/index.vue";
|
|
||||||
import DrawerSection from "./components/DrawerSection/index.vue";
|
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 29 KiB |
@@ -7,7 +7,7 @@ import { getServiceUrl } from "../api/GetServiceUrlApi";
|
|||||||
const versionValue = "1.1.1";
|
const versionValue = "1.1.1";
|
||||||
|
|
||||||
/// 是否是测试版本, 测试版本为true, 发布版本为false
|
/// 是否是测试版本, 测试版本为true, 发布版本为false
|
||||||
const developVersion = true;
|
const developVersion = false;
|
||||||
|
|
||||||
// 获取服务地址
|
// 获取服务地址
|
||||||
const getEvnUrl = async () => {
|
const getEvnUrl = async () => {
|
||||||
|
|||||||
10
src/uni.scss
@@ -13,11 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* 主题颜色(由 switch-client 命令自动更新) */
|
/* 主题颜色(由 switch-client 命令自动更新) */
|
||||||
$theme-color-800: #174BB6;
|
$theme-color-800: #0B7034;
|
||||||
$theme-color-700: #145EE1;
|
$theme-color-700: #0B5C2D;
|
||||||
$theme-color-500: #2D91FF;
|
$theme-color-500: #0CCD58;
|
||||||
$theme-color-100: #D9EEFF;
|
$theme-color-100: #E8FFF1;
|
||||||
$theme-color-50: #EEF8FF;
|
$theme-color-50: #F0F8F3;
|
||||||
|
|
||||||
// text 颜色
|
// text 颜色
|
||||||
$text-color-900: #181B25;
|
$text-color-900: #181B25;
|
||||||
|
|||||||