Skip to content

Commit

Permalink
fix: better name and counter store
Browse files Browse the repository at this point in the history
  • Loading branch information
amiller68 committed Apr 4, 2024
1 parent 92ef857 commit 0c8ed62
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/boot/utils.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { boot } from "quasar/wrappers";

import { Buffer } from "buffer";
import Uploader from "../components/Uploader.js";
import KnowledgeStoreUploader from "../components/KnowledgeStoreUploader.js";
// "async" is optional;
// more info on params: https://v2.quasar.dev/quasar-cli/boot-files
export default boot(async ({ app }) => {
// something to do
window.Buffer = Buffer;
window.global = window;
app.config.globalProperties.window = window;
app.component("Uploader", Uploader);
app.component("KnowledgeStoreUploader", KnowledgeStoreUploader);
});
6 changes: 3 additions & 3 deletions src/components/Uploader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createUploaderComponent } from "quasar";
import { createKnowledgeStoreUploaderComponent } from "quasar";
import { computed, ref } from "vue";
import { useKnowledgeStore } from "../stores/knowledge-store";
// import * as pdfjsLib from 'pdfjs-dist/webpack';
Expand Down Expand Up @@ -64,8 +64,8 @@ async extractTextFromPdf(pdfUrl) {
*/

// export a Vue component
export default createUploaderComponent({
name: "Uploader",
export default createKnowledgeStoreUploaderComponent({
name: "KnowledgeStoreUploader",
props: {
// ...your custom props
},
Expand Down
12 changes: 0 additions & 12 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
@click="toggleLeftDrawer"
/>

<!-- <q-toolbar-title>
Quasar App
</q-toolbar-title> -->
<q-space />

<div class="row q-gutter-x-sm">
Expand Down Expand Up @@ -196,8 +193,6 @@ export default defineComponent({
const route = useRoute();
// Reference to the chat-store state
// TODO: intialize chatsStore.partialChats as null and implement async loading rendering
//const partialChatsRef = ref(chatsStore.partialChats);
const { partialChats } = storeToRefs(chatsStore);
const addressPoints = computed(() => {
Expand All @@ -217,18 +212,11 @@ export default defineComponent({
}
});
// Watch for updates to the chats and update our partials
watch(partialChats, (newVal) => {
console.log("layouts::MainLayout::watch::partialChatsRef: ", newVal);
});
// Delete a chat
// NOTE: the underlying state of partialChatsRef is updated as a result of the watch above
async function deleteChat(chat_id) {
console.log("layouts::MainLayout::deleteChat: ", chat_id);
await chatsStore.deleteChat(chat_id);
// Update local state
// partialChats.value = chatsStore.partialChats;
if (route.params?.id == chat_id) {
nextTick(() => router.push("/new"));
}
Expand Down
1 change: 0 additions & 1 deletion src/pages/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ export default defineComponent({
// Regenerate the last message from the AI
async function regenerateMessage() {
console.log("pages::Chat.vue::regenerateMessage");
console.log("pages::Chat.vue::regenerateMessage");
// we discard the last message if it's from the AI, and regenerate
const lastMessage = messagesRef.value[messagesRef.value.length - 1];
Expand Down
18 changes: 0 additions & 18 deletions src/pages/IndexPage.vue

This file was deleted.

4 changes: 2 additions & 2 deletions src/pages/KnowledgeBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
</q-card-actions>
</q-card>-->
haha
<Uploader
label="Auto Uploader"
<KnowledgeStoreUploader
label="Auto KnowledgeStoreUploader"
auto-upload
url="http://localhost:4444/upload"
multiple
Expand Down
4 changes: 4 additions & 0 deletions src/pages/PointsInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
bottom-slots
v-model="address"
label="Address"
counter
maxlength="42"
:rules="addressRules"
autofocus
Expand Down Expand Up @@ -122,12 +123,14 @@

<script>
import { defineComponent, ref, onMounted, nextTick } from "vue";
import { useCounterStore } from "../stores/counter-store";
import { usePoints } from "../stores/points";
import { ethers } from "ethers";
export default defineComponent({
name: "PointsInfo",
setup() {
const counter = useCounterStore();
const expanded = ref(false);
const points = usePoints();
const address = ref("");
Expand Down Expand Up @@ -157,6 +160,7 @@ export default defineComponent({
// const count = ref(0)
return {
points,
counter,
expanded,
address,
addressVerifier,
Expand Down
15 changes: 15 additions & 0 deletions src/stores/counter-store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineStore } from "pinia";

export const useCounterStore = defineStore("counter", {
state: () => ({
counter: 0,
}),
getters: {
doubleCount: (state) => state.counter * 2,
},
actions: {
increment() {
this.counter++;
},
},
});

0 comments on commit 0c8ed62

Please sign in to comment.