Thu Jul 13 19:31:00 CST 2023 inscode

上级 56bb00e0
......@@ -88,7 +88,7 @@
<img v-if="item.img" :src="item.img"/>
<img v-else src="/loading.gif" class="w-[512px]"/>
</template>
<template>
<template v-else>
{{ item.message ? item.message : '...' }}
</template>
......@@ -446,7 +446,11 @@ export default {
StorageApi.get(this.history.name).then(data => {
if (data && data.data) {
this.message = JSON.parse(data.data)
const historyMessage = JSON.parse(data.data)
if (historyMessage !== null && historyMessage.length > 0) {
this.message = historyMessage
}
}
})
},
......@@ -498,16 +502,16 @@ export default {
if (type === 'common') {
this.sdServerUrl = this.config.common_gpt_api
this.sdServerUrl = this.config.common_gpt_url
}
this.saveConfig()
},
recoverConfig () {
const config = localStorage.getItem('ai-docs-config')
debugger
if (config) {
const configJSON = JSON.parse(config)
this.config = configJSON
this.sdServerType = configJSON.sdServerType
this.sdServerUrl = configJSON.sdServerUrl
this.sdServerType = configJSON.sdServerType??'common'
......@@ -516,7 +520,7 @@ export default {
document.title = this.name
if (data.ext && data.ext.common_sd_api && this.sdServerType === 'common') {
if (data.ext && data.ext.common_gpt_url && this.sdServerType === 'common') {
this.config.common_gpt_url = data.ext.common_gpt_url
this.sdServerUrl = data.ext.common_gpt_url
}
......@@ -555,6 +559,7 @@ export default {
if (this.mode === 'chat') {
this.initAIClient()
this.initIndexClient()
this.prompt = this.config.default_prompt
}
}
......
......@@ -11,7 +11,7 @@ class OpenAI {
}
createCompletion (prompt, history, context, callback) {
debugger
const config = this.config
const abortController = new AbortController();
......@@ -41,6 +41,7 @@ class OpenAI {
stop: stop_key
// prefix: prefix
}
if (mode === 'chat') {
data.messages = Prompt.getPromptByChatMode(config, context, history)
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册