提交 d966ca23 编写于 作者: W weixin_44463441

Fri Jan 12 10:08:00 CST 2024 inscode

上级 a34ffdcb
<template>
<div class="w-full h-screen">
<div class="w-full h-dvh">
<!-- toolbar -->
<div class="w-full h-14 pt-2 border-b-2 shadow-2xl fixed bg-slate-200 flex items-center">
<div class="w-full h-14 border-b-2 shadow-2xl fixed bg-slate-200 flex justify-between items-center px-4 md:px-10">
<div class="flex-none w-1/3">
</div>
<div class="flex-none w-1/3 text-center">
<span class="leading-10 font-bold">{{ name }} {{ config?.mode === 'completions' ? '(无上下文)' : '' }}</span>
<div class="flex-none flex gap-2 items-center">
<img class="w-8 h-8 rounded-full" src="https://csdn-665-inscode.s3.cn-north-1.jdcloud-oss.com/inscode/202307/622aa39c1f9b166ab1a38c05/1689313832234-63659446-QeEVrAvJoQIMBZjs2NChZ0MzsXv2Gz8B/avatar"/>
<span class="font-bold">{{ name }}</span>
</div>
<div class="flex-none w-1/3 *:ml-4 *:text-gray-600 *:hover:text-gray-900 text-sm float-right flex justify-end pr-4">
<button @click="page='chat'">Chat</button>
<button @click="page='content'">知识库</button>
<div class="flex-none *:ml-4 text-sm flex justify-end items-center">
<button @click="page='chat'" :class="['text-gray-600', page === 'chat' ? 'text-blue-600' : '', page === 'chat' ? 'underline' : '']">Chat</button>
<button @click="page='content'" :class="['text-gray-600', page === 'content' ? 'text-blue-600' : '', page === 'content' ? 'underline' : '']">知识库</button>
<button>设置</button>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
......@@ -155,7 +153,7 @@ export default {
},
data() {
return {
page: '',
page: 'chat',
id: 0,
name: '加载中...',
userAvatarList: [],
......
......@@ -3,27 +3,39 @@
<div class="p-4">
<div class="flex ju">
<input class="block my-2 w-full" v-model="newContent" maxLength="50"/>
<button class="bg-gray-300 px-4 h-10 rounded hover:bg-gray-400" @click="add"> add</button>
<button class="bg-gray-300 px-4 h-10 rounded hover:bg-gray-400 ml-2" @click="search"> search</button>
</div>
<span>添加内容</span>
<textarea class="block my-2 w-full" v-model="newContent" maxLength="512"></textarea>
<button class="bg-gray-300 py-2 px-4 rounded hover:bg-gray-400" @click="add"> add</button>
<button class="bg-gray-300 py-2 px-4 rounded hover:bg-gray-400 ml-2" @click="search"> search</button>
<div class="w-full mt-4">
<div class="float-right">
<span class="text-gray-500 text-sm">
{{ data?.total }}条数据
</span>
</div>
<table class="table-auto w-full bg-gray-200 text-left">
<thead>
<tr class="h-10 *:border-b *:border-slate-300 *:pl-2 *:bold">
<th >ID</th>
<th >#</th>
<th >内容</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="item in list" class="*:h-12 *:border-b *:border-slate-300 *:pl-2 *:hover:bg-gray-300">
<td class="w-[80px]">{{ item._id }}</td>
<tr v-for="(item, index) in data.list" class="*:h-12 *:border-b *:border-slate-300 *:pl-2 *:hover:bg-gray-300">
<td class="w-[80px]">{{ index + 1 }}</td>
<td>
<textarea class="my-2 w-full bg-gray-100 max-h-48 border-gray-300" v-model="item.content" maxLength="512"></textarea>
<textarea class="my-2 w-full bg-gray-100 max-h-48 border-gray-300 text-slate-600 text-sm" v-model="item.content" maxLength="512"></textarea>
</td>
<td class="*:py-1 *:px-4 *:rounded-md *:mr-2 *:text-gray-100 w-[160px]">
<button @click="deleteItem(item)" class="bg-orange-400 hover:bg-orange-500"> 删除</button>
......@@ -53,7 +65,8 @@ export default {
data() {
return {
newContent: '',
list: []
list: [],
data: {}
}
},
methods: {
......@@ -71,7 +84,7 @@ export default {
search () {
esClient.query(this.newContent).then(res => {
console.info(res)
this.list = res
this.data = res
})
},
......
......@@ -50,7 +50,10 @@ class RepEs {
});
}
resolve(result)
resolve({
total: total,
list: result
})
}).catch((err) => {
console.error(err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册