update integration
This commit is contained in:
1 parent
ed43ab5afd
commit
cef6e17736
18 files changed
+303
-216
No files matched your search
@@ -1,20 +1,22 @@
|
||||
<template>
|
||||
<div class="message">
|
||||
<el-image :src="author.avatar" class="icon" />
|
||||
<message-content :content="content" class="content" />
|
||||
<message-content :content="content" class="content" :error="error" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IBot, IUser } from '@/operators';
|
||||
import { IContent } from '@/operators/message/models';
|
||||
import { IContent, IError } from '@/operators/message/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import MessageContent from './MessageContent.vue';
|
||||
import { ElImage } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Message',
|
||||
components: {
|
||||
MessageContent
|
||||
MessageContent,
|
||||
ElImage
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
@@ -24,6 +26,13 @@ export default defineComponent({
|
||||
author: {
|
||||
type: Object as () => IUser | IBot,
|
||||
required: true
|
||||
},
|
||||
error: {
|
||||
type: Object as () => IError | undefined,
|
||||
required: false,
|
||||
default() {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -42,7 +51,11 @@ export default defineComponent({
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.icon {
|
||||
width: 100px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-right: 20px;
|
||||
border-radius: 3px;
|
||||
min-width: 30px;
|
||||
}
|
||||
.content {
|
||||
flex: 1;
|
||||
|
||||
@@ -1,21 +1,31 @@
|
||||
<template>
|
||||
<markdown-renderer :content="content.value" />
|
||||
<el-alert v-if="error" :title="error?.detail" type="error" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IContent } from '@/operators/message/models';
|
||||
import { IContent, IError } from '@/operators/message/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { ElAlert } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MessageContent',
|
||||
components: {
|
||||
MarkdownRenderer
|
||||
MarkdownRenderer,
|
||||
ElAlert
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
type: Object as () => IContent,
|
||||
required: true
|
||||
},
|
||||
error: {
|
||||
type: Object as () => IError | undefined,
|
||||
required: false,
|
||||
default() {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<template>
|
||||
<el-input v-model="value" placeholder="Type something">
|
||||
<el-input
|
||||
v-model="value"
|
||||
:placeholder="$t('conversation.message.newMessagePlaceholder')"
|
||||
@keyup.enter="$emit('send')"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-icon class="el-input__icon" @click="$emit('send')">send</el-icon>
|
||||
<font-awesome-icon icon="fa-regular fa-paper-plane" class="icon-send" @click="$emit('send')" />
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
@@ -9,11 +13,14 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElInput, ElButton, ElIcon } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NewMessageBox',
|
||||
components: {
|
||||
ElInput,
|
||||
ElIcon
|
||||
ElIcon,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
@@ -34,9 +41,19 @@ export default defineComponent({
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
console.log('ccc', this.value);
|
||||
this.$emit('update:modelValue', this.value);
|
||||
},
|
||||
modelValue(val) {
|
||||
if (val !== this.value) {
|
||||
this.value = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.icon-send {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user