1
1
<script setup lang="ts">
2
- import {computed , onUpdated } from " vue"
2
+ import {computed , onUpdated , ref } from " vue"
3
3
import {ChatMessage , toChatMessages , unescapeHtml } from " ../../helper"
4
4
import {marked } from " marked"
5
5
import katex from ' katex'
@@ -19,6 +19,7 @@ let iconMap = {
19
19
' user' : ' mdi-account' ,
20
20
' system' : ' mdi-laptop'
21
21
}
22
+ let showSystemPrompt = ref (false )
22
23
23
24
function renderMD(content : string ) {
24
25
const renderer = new marked .Renderer ()
@@ -151,8 +152,14 @@ onUpdated(() => {
151
152
<v-icon >{{ iconMap?.[message.role as keyof typeof iconMap] ?? 'mdi-account-multiple' }}</v-icon >
152
153
<p class =" ml-3" style =" text-transform : uppercase !important ;" >{{ message.role }}</p >
153
154
<p class =" ml-3 text-caption" style =" color : #999 " >{{ message.type }}</p >
155
+ <v-btn class =" ml-3" v-if =" message.role==='system' && message.type==='additional_instructions'"
156
+ size =" small" variant =" text" @click =" showSystemPrompt=!showSystemPrompt" >
157
+ {{ showSystemPrompt ? 'Hide' : 'Show' }}
158
+ </v-btn >
154
159
</div >
155
- <div v-html =" renderMessage(message)" class =" my-1" ></div >
160
+ <div v-if =" showSystemPrompt || !(message.role==='system' && message.type==='additional_instructions')"
161
+ v-html =" renderMessage(message)" class =" my-1" ></div >
162
+ <div v-else class =" text-caption" >...(omitted)</div >
156
163
<v-divider class =" my-3" v-if =" index!==chatMessages.length-1" ></v-divider >
157
164
</div >
158
165
</div >
0 commit comments