Thu Jul 13 18:32:00 CST 2023 inscode

上级 25fd1baa
......@@ -284,15 +284,30 @@ export default {
return
}
this.loading = true
if (this.mode === 'draw') {
this.draw()
} else {
const _this = this
const messages = this.message
const currentMsg = {
"user": "AI", "message": ''
}
const newPrompt = this.prompt
this.prompt = ''
messages.push({ "user": "User", "message": newPrompt })
messages.push(currentMsg)
_this.$refs.messageList.scrollTop = _this.$refs.messageList.scrollHeight;
if (this.indexClient) {
this.indexClient.query(this.prompt).then(res => {
this.getAnswer(res)
this.indexClient.query(newPrompt).then(res => {
this.getAnswer(res, newPrompt, currentMsg)
}).catch((err) => {
this.getAnswer()
this.getAnswer(null, newPrompt, currentMsg)
})
}
}
......@@ -358,21 +373,13 @@ export default {
_this.loading = false
})
},
getAnswer(context) {
this.loading = true
getAnswer(context = null, prompt = null, currentMsg = null) {
const newPrompt = prompt ? prompt : this.prompt
const _this = this
this.config.api_url = this.sdServerUrl
const messages = this.message
const currentMsg = {
"user": "AI", "message": ''
}
messages.push({ "user": "User", "message": this.prompt })
messages.push(currentMsg)
_this.$refs.messageList.scrollTop = _this.$refs.messageList.scrollHeight;
const newPrompt = this.prompt
console.info(this.prompt)
console.info(newPrompt)
this.prompt = ''
this.client.createCompletion(
newPrompt,
this.message,
......@@ -490,7 +497,7 @@ export default {
handleSDServerTypeChange (type) {
if (type === 'common') {
debugger
this.sdServerUrl = this.config.common_gpt_api
}
this.saveConfig()
......@@ -509,7 +516,7 @@ export default {
document.title = this.name
if (data.ext && data.ext.common_sd_api) {
if (data.ext && data.ext.common_sd_api && this.sdServerType === 'common') {
this.config.common_gpt_url = data.ext.common_gpt_url
this.sdServerUrl = data.ext.common_gpt_url
}
......
......@@ -10,8 +10,8 @@ export default {
"resource_type": "app",
"ext": {
"mode":"chat",
"model":"chatgl2-6b",
"common_gpt_url":"https://api.quickapi.cloud/temporary/gpt/",
"model":"chatglm2-6b",
"common_gpt_url":"https://api.quickapi.cloud/temporary/gpt",
"api_type":"openai",
"robot_img":null,
"api_max_token":"2048",
......
......@@ -11,6 +11,7 @@ class OpenAI {
}
createCompletion (prompt, history, context, callback) {
debugger
const config = this.config
const abortController = new AbortController();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册