Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
002db29717 |
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img alt="demo" src="./demos/demo.gif?v=1">
|
||||
<img alt="demo" src="./demos/demo.png?v=1">
|
||||
</p>
|
||||
|
||||
# ChatGPT UI
|
||||
|
||||
@@ -20,6 +20,7 @@ const contentHtml = computed(() => {
|
||||
<template>
|
||||
<div
|
||||
v-html="contentHtml"
|
||||
class="text-body-1 text-justify"
|
||||
></div>
|
||||
|
||||
</template>
|
||||
BIN
demos/demo.gif
BIN
demos/demo.gif
Binary file not shown.
|
Before Width: | Height: | Size: 143 KiB |
BIN
demos/demo.png
Normal file
BIN
demos/demo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
@@ -3,6 +3,7 @@ definePageMeta({
|
||||
middleware: ["auth"]
|
||||
})
|
||||
import {EventStreamContentType, fetchEventSource} from '@microsoft/fetch-event-source'
|
||||
import { nextTick } from 'vue'
|
||||
|
||||
const { $i18n, $auth } = useNuxtApp()
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
@@ -49,7 +50,7 @@ const fetchReply = async (message, parentMessageId) => {
|
||||
onerror(err) {
|
||||
throw err;
|
||||
},
|
||||
onmessage(message) {
|
||||
async onmessage(message) {
|
||||
// console.log(message)
|
||||
const event = message.event
|
||||
const data = JSON.parse(message.data)
|
||||
@@ -119,28 +120,49 @@ const showSnackbar = (text) => {
|
||||
snackbar.value = true
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="currentConversation.messages.length > 0"
|
||||
ref="chatWindow"
|
||||
>
|
||||
<v-card
|
||||
rounded="0"
|
||||
elevation="0"
|
||||
v-for="(conversation, index) in currentConversation.messages"
|
||||
:key="index"
|
||||
:variant="conversation.is_bot ? 'tonal' : 'text'"
|
||||
>
|
||||
<v-container>
|
||||
<v-card-text class="text-caption text-disabled">{{ $t(`roles.${conversation.is_bot?'ai':'me'}`) }}</v-card-text>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="(message, index) in currentConversation.messages" :key="index"
|
||||
cols="12"
|
||||
>
|
||||
<div
|
||||
class="d-flex"
|
||||
:class="message.is_bot ? 'justify-start mr-16' : 'justify-end ml-16'"
|
||||
>
|
||||
<v-card
|
||||
:color="message.is_bot ? '' : 'primary'"
|
||||
rounded="lg"
|
||||
elevation="2"
|
||||
>
|
||||
<v-card-text>
|
||||
<MsgContent :content="conversation.message" />
|
||||
<MsgContent :content="message.message" />
|
||||
</v-card-text>
|
||||
</v-container>
|
||||
<v-divider></v-divider>
|
||||
|
||||
<!-- <v-card-actions-->
|
||||
<!-- v-if="message.is_bot"-->
|
||||
<!-- >-->
|
||||
<!-- <v-spacer></v-spacer>-->
|
||||
<!-- <v-tooltip text="Copy">-->
|
||||
<!-- <template v-slot:activator="{ props }">-->
|
||||
<!-- <v-btn v-bind="props" icon="content_copy"></v-btn>-->
|
||||
<!-- </template>-->
|
||||
<!-- </v-tooltip>-->
|
||||
<!-- </v-card-actions>-->
|
||||
</v-card>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<div ref="grab" class="w-100" style="height: 200px;"></div>
|
||||
</div>
|
||||
<Welcome v-else />
|
||||
|
||||
Reference in New Issue
Block a user