-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
140 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,65 @@ | ||
<template> | ||
<layout> | ||
<template #chatdoc> Index </template> | ||
<template #chatdoc> | ||
<el-card @click="onCreate"> | ||
<font-awesome-icon :icon="['fas', 'book']" /> | ||
</el-card> | ||
<el-card | ||
v-for="(repository, repositoryIndex) in repositories" | ||
:key="repositoryIndex" | ||
class="repository" | ||
@click="onClick(repository)" | ||
> | ||
{{ repository.id }} | ||
</el-card> | ||
</template> | ||
</layout> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import Layout from '@/layouts/Chatdoc.vue'; | ||
import { ElCard } from 'element-plus'; | ||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; | ||
import { IChatdocRepository } from '@/operators'; | ||
import { ROUTE_CHATDOC_KNOWLEDGE } from '@/router'; | ||
export default defineComponent({ | ||
name: 'ChatdocKnowledge', | ||
components: { | ||
Layout | ||
Layout, | ||
ElCard, | ||
FontAwesomeIcon | ||
}, | ||
data() { | ||
return {}; | ||
}, | ||
computed: { | ||
repositories() { | ||
return this.$store.state.chatdoc.repositories; | ||
} | ||
}, | ||
async mounted() {}, | ||
methods: {} | ||
methods: { | ||
onCreate() { | ||
console.log('onCreate'); | ||
}, | ||
onClick(repository: IChatdocRepository) { | ||
console.log('onClick', repository); | ||
this.$router.push({ | ||
name: ROUTE_CHATDOC_KNOWLEDGE, | ||
params: { | ||
id: repository.id | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.repository { | ||
width: 300px; | ||
margin-bottom: 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,58 @@ | ||
<template> | ||
<layout> | ||
<template #chatdoc> Knowledge </template> | ||
<template #chatdoc> | ||
<el-button @click="onUpload">upload</el-button> | ||
<el-card v-for="(document, documentIndex) in documents" :key="documentIndex" class="document"> | ||
{{ document.id }} | ||
</el-card> | ||
<el-alert v-if="documents?.length === 0" type="info" description="no documents" /> | ||
</template> | ||
</layout> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import Layout from '@/layouts/Chatdoc.vue'; | ||
import { IChatdocRepository } from '@/operators'; | ||
import { ElCard, ElButton, ElAlert } from 'element-plus'; | ||
export default defineComponent({ | ||
name: 'ChatdocKnowledge', | ||
components: { | ||
Layout | ||
Layout, | ||
ElButton, | ||
ElCard, | ||
ElAlert | ||
}, | ||
data() { | ||
return {}; | ||
return { | ||
loading: false, | ||
id: this.$route.params.id.toString() | ||
}; | ||
}, | ||
async mounted() {}, | ||
methods: {} | ||
computed: { | ||
repository(): IChatdocRepository | undefined { | ||
return this.$store.state?.chatdoc?.repositories?.find((repository) => repository.id === this.id); | ||
}, | ||
documents() { | ||
return this.repository?.documents; | ||
} | ||
}, | ||
async mounted() { | ||
this.loading = true; | ||
this.$store | ||
.dispatch('chatdoc/getRepository', { id: this.id }) | ||
.then(() => { | ||
this.loading = false; | ||
}) | ||
.catch(() => { | ||
this.loading = false; | ||
}); | ||
}, | ||
methods: { | ||
onUpload() { | ||
console.log('onUpload'); | ||
} | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters