Feat(云灵AI):对话接口对接完成
This commit is contained in:
@@ -14,55 +14,61 @@
|
||||
<view class="item six" />
|
||||
<view class="item seven" />
|
||||
</view>
|
||||
<view class="bottom-body flex-center-between">
|
||||
<!-- 输入模式切换 -->
|
||||
<view
|
||||
class="input-model"
|
||||
@click="toggleInputModel"
|
||||
>
|
||||
输入模式
|
||||
<view v-if="inputModel === 'input'" class="bottom-body flex-center-between">
|
||||
<view class="history-wrap" @click="historyViewHandle">
|
||||
历史
|
||||
</view>
|
||||
<!-- 输入框 -->
|
||||
<view
|
||||
v-if="inputModel === 'input'"
|
||||
class="input-wrap flex-center-between"
|
||||
>
|
||||
<input
|
||||
v-model.trim="prompt"
|
||||
:show-confirm-bar="false"
|
||||
:disabled="loading"
|
||||
:maxlength="-1"
|
||||
class="inp"
|
||||
@confirm="sendHandle"
|
||||
@focus="promptInputFocusHandle"
|
||||
@blur="promptInputBlurHandle"
|
||||
/>
|
||||
<view v-if="!prompt && !inputOnFocus" class="placeholder-txt">请输入关键字...</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="inputModel === 'input'"
|
||||
class="send-btn"
|
||||
>
|
||||
<view class="input-container">
|
||||
<!-- 输入模式切换 -->
|
||||
<view
|
||||
class="input-model"
|
||||
@click="toggleInputModel"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/aiChat/microphone.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<!-- 输入框 -->
|
||||
<view class="input-wrap flex-center-between">
|
||||
<input
|
||||
v-model.trim="prompt"
|
||||
:show-confirm-bar="false"
|
||||
:disabled="loading"
|
||||
:maxlength="-1"
|
||||
class="inp"
|
||||
@confirm="sendHandle"
|
||||
@focus="promptInputFocusHandle"
|
||||
@blur="promptInputBlurHandle"
|
||||
/>
|
||||
<view v-if="!prompt && !inputOnFocus" class="placeholder-txt">发消息...</view>
|
||||
</view>
|
||||
<view
|
||||
class="send-btn"
|
||||
@click="sendHandle"
|
||||
>
|
||||
发送
|
||||
<image
|
||||
:src="webUrl + '/aiChat/send.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 语音输入 -->
|
||||
<view
|
||||
v-if="inputModel === 'sound'"
|
||||
class="sound-input-wrap"
|
||||
@touchstart="startRecord"
|
||||
@touchend="stopRecord"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/icon-20.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
按住说话
|
||||
</view>
|
||||
</view>
|
||||
<!-- 语音输入 -->
|
||||
<view
|
||||
v-if="inputModel === 'sound'"
|
||||
class="sound-input-wrap"
|
||||
@touchstart="startRecord"
|
||||
@touchend="stopRecord"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/icon-20.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
按住说话
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -87,10 +93,10 @@ export default {
|
||||
return {
|
||||
token: cookie.get('login_status'),
|
||||
userInfo: cookie.get('userInfo'),
|
||||
webUrl: this.$webUrl,
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
// 输入模式:input-键盘,sound-语音
|
||||
inputModel: 'input',
|
||||
prompt: '今天天气',
|
||||
prompt: '',
|
||||
recordManager: null,
|
||||
// 录音权限是否开通
|
||||
recordPermission: false,
|
||||
@@ -262,6 +268,9 @@ export default {
|
||||
this.$emit('send', { prompt: this.prompt })
|
||||
this.prompt = ''
|
||||
this.inputOnFocus = false
|
||||
},
|
||||
historyViewHandle() {
|
||||
this.$emit('history')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user