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

Thu Jan 11 13:53:00 CST 2024 inscode

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