mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-04 07:27:41 +08:00
115 lines
3.5 KiB
Vue
115 lines
3.5 KiB
Vue
<script setup lang="ts">
|
||
import "deep-chat";
|
||
import { ref, onMounted } from "vue";
|
||
|
||
const chatRef = ref();
|
||
|
||
onMounted(() => {
|
||
chatRef.value.demo = {
|
||
response: message => {
|
||
console.log(message);
|
||
return {
|
||
text: "仅演示,如需AI服务,请参考 https://deepchat.dev/docs/connect"
|
||
};
|
||
}
|
||
};
|
||
});
|
||
</script>
|
||
|
||
<template>
|
||
<deep-chat
|
||
ref="chatRef"
|
||
style="border-radius: 10px"
|
||
:messageStyles="{
|
||
default: {
|
||
shared: {
|
||
bubble: {
|
||
maxWidth: '100%',
|
||
backgroundColor: 'unset',
|
||
marginTop: '10px',
|
||
marginBottom: '10px'
|
||
}
|
||
},
|
||
user: {
|
||
bubble: {
|
||
marginLeft: '0px',
|
||
color: 'black'
|
||
}
|
||
},
|
||
ai: {
|
||
outerContainer: {
|
||
backgroundColor: 'rgba(247,247,248)',
|
||
borderTop: '1px solid rgba(0,0,0,.1)',
|
||
borderBottom: '1px solid rgba(0,0,0,.1)'
|
||
}
|
||
}
|
||
}
|
||
}"
|
||
:avatars="{
|
||
default: { styles: { position: 'left' } },
|
||
ai: { src: 'https://xiaoxian521.github.io/hyperlink/svg/openai.svg' }
|
||
}"
|
||
:submitButtonStyles="{
|
||
submit: {
|
||
container: {
|
||
default: {
|
||
padding: '1px 0 0 5px',
|
||
backgroundColor: '#19c37d'
|
||
},
|
||
hover: { backgroundColor: '#0bab69' },
|
||
click: { backgroundColor: '#068e56' }
|
||
},
|
||
svg: {
|
||
content:
|
||
'<?xml version="1.0" ?> <svg viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"> <g> <path d="M21.66,12a2,2,0,0,1-1.14,1.81L5.87,20.75A2.08,2.08,0,0,1,5,21a2,2,0,0,1-1.82-2.82L5.46,13H11a1,1,0,0,0,0-2H5.46L3.18,5.87A2,2,0,0,1,5.86,3.25h0l14.65,6.94A2,2,0,0,1,21.66,12Z"> </path> </g> </svg>',
|
||
styles: {
|
||
default: {
|
||
filter:
|
||
'brightness(0) saturate(100%) invert(100%) sepia(28%) saturate(2%) hue-rotate(69deg) brightness(107%) contrast(100%)'
|
||
}
|
||
}
|
||
}
|
||
},
|
||
loading: {
|
||
container: { default: { backgroundColor: 'white' } },
|
||
svg: {
|
||
styles: {
|
||
default: {
|
||
filter:
|
||
'brightness(0) saturate(100%) invert(72%) sepia(0%) saturate(3044%) hue-rotate(322deg) brightness(100%) contrast(96%)'
|
||
}
|
||
}
|
||
}
|
||
},
|
||
stop: {
|
||
container: {
|
||
default: { backgroundColor: 'white' },
|
||
hover: { backgroundColor: '#dadada52' }
|
||
},
|
||
svg: {
|
||
content:
|
||
'<?xml version="1.0" encoding="utf-8"?> <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <rect width="24" height="24" rx="4" ry="4" /> </svg>',
|
||
styles: {
|
||
default: {
|
||
width: '0.95em',
|
||
marginTop: '0.32em',
|
||
filter:
|
||
'brightness(0) saturate(100%) invert(72%) sepia(0%) saturate(3044%) hue-rotate(322deg) brightness(100%) contrast(96%)'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}"
|
||
:textInput="{ placeholder: { text: '发送消息' } }"
|
||
:history="[
|
||
{ text: '李白是谁?', role: 'user' },
|
||
{
|
||
text: '李白(701年2月28日-762年),号青莲居士,又号“谪仙人”,是唐代著名的浪漫主义诗人,被后人誉为“诗仙”。',
|
||
role: 'ai'
|
||
}
|
||
]"
|
||
:demo="true"
|
||
:connect="{ stream: true }"
|
||
/>
|
||
</template>
|