chatgpt ui
This commit is contained in:
1 parent
523ab178a4
commit
ed43ab5afd
24 files changed
+495
-34
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="message">
|
||||
<el-image :src="author.avatar" class="icon" />
|
||||
<message-content :content="content" class="content" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IBot, IUser } from '@/operators';
|
||||
import { IContent } from '@/operators/message/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import MessageContent from './MessageContent.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Message',
|
||||
components: {
|
||||
MessageContent
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
type: Object as () => IContent,
|
||||
required: true
|
||||
},
|
||||
author: {
|
||||
type: Object as () => IUser | IBot,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
conversationId() {
|
||||
return this.$route.params?.id?.toString();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.message {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.icon {
|
||||
width: 100px;
|
||||
}
|
||||
.content {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<markdown-renderer :content="content.value" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IContent } from '@/operators/message/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MessageContent',
|
||||
components: {
|
||||
MarkdownRenderer
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
type: Object as () => IContent,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
conversationId() {
|
||||
return this.$route.params?.id?.toString();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<el-input v-model="value" placeholder="Type something">
|
||||
<template #suffix>
|
||||
<el-icon class="el-input__icon" @click="$emit('send')">send</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElInput, ElButton, ElIcon } from 'element-plus';
|
||||
export default defineComponent({
|
||||
name: 'NewMessageBox',
|
||||
components: {
|
||||
ElInput,
|
||||
ElIcon
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
emits: ['send', 'update:modelValue'],
|
||||
data() {
|
||||
return {
|
||||
value: this.modelValue
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
conversationId() {
|
||||
return this.$route.params?.id?.toString();
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
console.log('ccc', this.value);
|
||||
this.$emit('update:modelValue', this.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user