diff --git a/src/App.vue b/src/App.vue
index 22dffa639b4b8da10338595f06871ccad6f681a8..0defdf5e74f2f1fab2ef4c9185753b898dcfb61b 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -88,7 +88,7 @@
-
+
{{ item.message ? item.message : '...' }}
@@ -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
}
}
diff --git a/src/js/openai.js b/src/js/openai.js
index 07814734c57335e9b44f90153408329b4c189f02..33a2efa64a14c730af28de1772e4b040e7a9f9f4 100644
--- a/src/js/openai.js
+++ b/src/js/openai.js
@@ -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 {