Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya committed Feb 16, 2024
1 parent 8c14cbb commit a711888
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
1 change: 1 addition & 0 deletions src/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="https://raw.githubusercontent.com/aniketmaurya/blog/main/assets/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">
<title>FastServe 🧡</title>
</head>
Expand Down
21 changes: 14 additions & 7 deletions src/ui/src/components/ChatBot.vue
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
<template>
<v-card>
<v-card-title>ChatBot</v-card-title>
<v-card-title>Chat with PDF</v-card-title>
<v-card-text>
<v-list>
<v-list-item v-for="message in messages" :key="message.id">
<v-list lines="three">
<v-list-item v-for="message in messages" :key="message.id" :value="message" rounded="xl">
<v-list-item-content>
<v-list-item-title v-text="message.text"></v-list-item-title>
<div>
<v-chip>🙋‍♂️ {{ message.user }}</v-chip><br><br>
<v-chip>🤖 {{ message.bot }}</v-chip>
</div>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card-text>
<v-card-actions>
<v-text-field v-model="newMessage" label="Type a message" @keyup.enter="sendMessage"></v-text-field>
<v-btn color="primary" @click="sendMessage">Send</v-btn>
<FileUploadCard />
</v-card-actions>
</v-card>
</template>

<script>
import FileUploadCard from './FileUpload.vue';
export default {
name: "ChatBot",
components: {
FileUploadCard
},
data() {
return {
messages: [],
newMessage: ""
newMessage: "Hey there!"
};
},
methods: {
sendMessage() {
if (this.newMessage) {
this.messages.push({ id: Date.now(), text: this.newMessage });
this.messages.push({ user: this.newMessage, bot: "Generated chatbot msg" });
this.newMessage = "";
}
}
Expand Down
39 changes: 12 additions & 27 deletions src/ui/src/components/FileUpload.vue
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
<template>
<v-container>
<v-card text="Chat with PDF">
<v-file-input
show-size
:rules="rules"
accept="application/pdf"
placeholder="Pick a PDF file or drag and drop it here"
prepend-icon="mdi-document"
label="PDF input"
density="compact"

></v-file-input>

</v-card>

</v-container>

<v-file-input show-size :rules="rules" accept="application/pdf" placeholder="Pick a PDF file or drag and drop it here"
prepend-icon="mdi-document" label="PDF input" density="compact"></v-file-input>
</template>

<script>
export default {
name: "FileUploadCard",
data: () => ({
rules: [
value => {
return !value || !value.length || value[0].size < 5000000 || 'PDF size should be less than 5 MB!'
},
],
}),
}
export default {
name: "FileUploadCard",
data: () => ({
rules: [
value => {
return !value || !value.length || value[0].size < 5000000 || 'PDF size should be less than 5 MB!'
},
],
}),
}
</script>
4 changes: 2 additions & 2 deletions src/ui/src/components/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@

<script>
import ImageCard from './ImageCard.vue';
import FileUploadCard from './FileUpload.vue';
import ChatBot from './ChatBot.vue';
export default {
name: "Layout",
components: {
ImageCard,
FileUploadCard,
ChatBot
},
data() {
return {
Expand Down

0 comments on commit a711888

Please sign in to comment.