提交 3bd76397 编写于 作者: W weixin_44463441

Thu Jan 11 13:53:00 CST 2024 inscode

上级 c6099eb8
......@@ -4,8 +4,8 @@
<div class="p-4">
<span>添加内容</span>
<textarea class="block my-2 w-full" v-model="newContent"></textarea>
<button class="bg-gray-300 py-2 px-4 rounded hover:bg-gray-400"> ass</button>
<textarea class="block my-2 w-full" :value="newContent"></textarea>
<button class="bg-gray-300 py-2 px-4 rounded hover:bg-gray-400" @click="add"> add</button>
</div>
</div>
......@@ -14,20 +14,20 @@
import Config from '../../js/config'
import RepEs from '../../js/repEs'
const esClient = new RepEs(Config)
const esClient = new RepEs(Config.getData().data.ext)
export default {
name: 'contentIndex',
components: {
},
data() {
return {
newContent: 'xxx'
newContent: '测试内容'
}
},
methods: {
add () {
esClient
debugger
esClient.add(this.newContent)
}
}
}
......
......@@ -36,7 +36,7 @@ Inscode文档地址:https://inscode-doc.inscode.cc/
// 外部内容库,没有时指定为null,你也可以替换为自己的知识库
// const index_url = null
const index_url = "https://es-api.inscode.cc/"
const index_url = "https://es-api.inscode.cc"
// 默认提示词
const default_prompt = '介绍下InsCode'
......@@ -64,7 +64,7 @@ export default {
"api_prompt_prefix":"结合上下文回答问题,如果问题不是技术问题,请直接回答不知道。\n问题为:",
"show_profile_setting":false,
"search_url": index_url,
"index_url": index_url,
"index_name":"inscode-rag",
"index_type":"es",
......
......@@ -44,12 +44,15 @@ class RepEs {
add (content) {
debugger
const url = this.index_url + '/' + this.index_name
const token = this.token
return new Promise(function(resolve,rejcet){
axios.put(url,{
data: {
axios.put(url,
{
user_token: token,
content: content,
}
}).then(res => {
},
{ withCredentials: true}
).then(res => {
if (res?.status === 200 && res?.data?.code === 200) {
const result = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册