fix experience
This commit is contained in:
1 parent
ea1c3413a5
commit
35a5854133
7 files changed
+128
-15
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div class="box"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MessageContent',
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
conversationId() {
|
||||
return this.$route.params?.id?.toString();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@keyframes blink {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.box {
|
||||
width: 5px;
|
||||
height: 20px;
|
||||
margin-top: 3px;
|
||||
background-color: black;
|
||||
animation: blink 1s infinite;
|
||||
}
|
||||
</style>
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="message">
|
||||
<el-image :src="author.avatar" class="icon" />
|
||||
<message-content :content="content" class="content" :error="error" />
|
||||
<message-content :content="content" class="content" :error="error" :state="state" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IBot, IUser } from '@/operators';
|
||||
import { IContent, IError } from '@/operators/message/models';
|
||||
import { IContent, IError, IMessageState } from '@/operators/message/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import MessageContent from './MessageContent.vue';
|
||||
import { ElImage } from 'element-plus';
|
||||
@@ -33,6 +33,13 @@ export default defineComponent({
|
||||
default() {
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
state: {
|
||||
type: Object as () => IMessageState,
|
||||
required: false,
|
||||
default() {
|
||||
return IMessageState.FINISHED;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
<template>
|
||||
<markdown-renderer :content="content.value" />
|
||||
<el-alert v-if="error" :title="error?.detail" type="error" />
|
||||
<markdown-renderer :content="content?.value" />
|
||||
<answering-mark v-if="shouldShowAnsweringMark" />
|
||||
<el-alert v-if="errorText" :title="errorText" type="error" :closable="false" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IContent, IError } from '@/operators/message/models';
|
||||
import { IContent, IError, IMessageState } from '@/operators/message/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { ElAlert } from 'element-plus';
|
||||
import { ERROR_CODE_API_ERROR, ERROR_CODE_BUSY, ERROR_CODE_BAD_REQUEST } from '@/constants';
|
||||
import AnsweringMark from './AnsweringMark.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MessageContent',
|
||||
components: {
|
||||
MarkdownRenderer,
|
||||
ElAlert
|
||||
ElAlert,
|
||||
AnsweringMark
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
@@ -26,11 +30,34 @@ export default defineComponent({
|
||||
default() {
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
state: {
|
||||
type: Object as () => IMessageState,
|
||||
required: false,
|
||||
default() {
|
||||
return IMessageState.FINISHED;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
conversationId() {
|
||||
return this.$route.params?.id?.toString();
|
||||
},
|
||||
shouldShowAnsweringMark() {
|
||||
// @ts-ignore
|
||||
return this.state === IMessageState.PENDING;
|
||||
},
|
||||
errorText() {
|
||||
if (this.error?.code === ERROR_CODE_BUSY) {
|
||||
return this.$t('conversation.message.errorBusy');
|
||||
}
|
||||
if (this.error?.code === ERROR_CODE_API_ERROR) {
|
||||
return this.$t('conversation.message.errorApiError');
|
||||
}
|
||||
if (this.error?.code === ERROR_CODE_BAD_REQUEST) {
|
||||
return this.$t('conversation.message.errorBadRequest');
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user