@bcc-code/vue-bcc-chat-ui 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@bcc-code/vue-bcc-chat-ui",
3
3
  "author": "bcc-code",
4
4
  "license": "Apache-2.0",
5
- "version": "2.2.0",
5
+ "version": "2.2.2",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -2,7 +2,8 @@
2
2
  import MarkdownIt from 'markdown-it'
3
3
 
4
4
  defineProps<{
5
- text: string
5
+ text: string,
6
+ metadata: Record<string, any>,
6
7
  }>()
7
8
 
8
9
  function toMarkdownHtml(str: string) {
@@ -32,7 +33,15 @@ function toMarkdownHtml(str: string) {
32
33
  </script>
33
34
 
34
35
  <template>
35
- <div v-html="toMarkdownHtml(text)" class="bcc-chat-msg-bubble" />
36
+ <div v-if="metadata.translated_message"
37
+ v-html="toMarkdownHtml(metadata.translated_message)"
38
+ class="bcc-chat-msg-bubble bcc-chat-msg-bubble--translation"
39
+ />
40
+ <div
41
+ v-html="toMarkdownHtml(text)"
42
+ class="bcc-chat-msg-bubble"
43
+ :class="{'bcc-chat-msg-bubble--translated': !!metadata.translated_message}"
44
+ />
36
45
  </template>
37
46
 
38
47
  <style lang="scss">
@@ -92,5 +101,18 @@ function toMarkdownHtml(str: string) {
92
101
  list-style: decimal;
93
102
  margin: 8px 0;
94
103
  }
104
+
105
+ &--translated {
106
+ border-top: 1px solid;
107
+ opacity: 0.8;
108
+
109
+ &:before {
110
+ content: 'original: ';
111
+ opacity: 0.8;
112
+ margin-bottom: 8px;
113
+ font-size: 12px;
114
+ display: block;
115
+ }
116
+ }
95
117
  }
96
118
  </style>