1212import { marked } from ' marked'
1313import { mapState } from ' vuex'
1414
15- import useStreamingWords from ' ../../../../../.. /composables/strings/StreamingWords.js'
16- import { sanitize } from ' ../../../../../.. /composables/strings/String.js'
15+ import useStreamingWords from ' @ /composables/strings/StreamingWords.js'
16+ import { sanitize } from ' @ /composables/strings/String.js'
1717
1818export default {
1919 name: ' StreamableContent' ,
@@ -74,20 +74,22 @@ export default {
7474 },
7575 computed: {
7676 ... mapState (' product/assistant' , [' supportedActions' ]),
77- text () {
78- if (this .modelValue ) {
79- return this .shouldStream ? this .streamedText : this .modelValue .streamable
80- }
77+ rawText () {
78+ const rawText = this .modelValue ? this .modelValue .streamable : this .string
8179
82- const plainText = this .shouldStream ? this .streamedText : this .string
83- if (! this .richContent ) return plainText
80+ if (this .richContent ) {
81+ return marked (rawText || ' ' , {
82+ breaks: true ,
83+ gfm: true
84+ })
85+ }
8486
85- const html = marked (plainText || ' ' , {
86- breaks : true ,
87- gfm : true
88- })
87+ return rawText
88+ } ,
89+ text () {
90+ const text = this . shouldStream ? this . streamedText : this . rawText
8991
90- return this .sanitize (html , {
92+ return this .sanitize (text , {
9193 supportedActions: this .supportedActions ,
9294 targetBlank: true ,
9395 appendQueryParameters: {
@@ -112,7 +114,9 @@ export default {
112114 }
113115 },
114116 mounted () {
115- if (this .shouldStream ) this .stream (this .string || this .modelValue .streamable )
117+ if (this .shouldStream ) {
118+ this .stream (this .rawText )
119+ }
116120 }
117121}
118122 </script >
0 commit comments