From c5ccd7900ca043bf570503f6853228dec775c542 Mon Sep 17 00:00:00 2001
From: 622aa39c1f9b166ab1a38c05 <622aa39c1f9b166ab1a38c05@devide>
Date: Thu, 13 Jul 2023 19:31:00 +0800
Subject: [PATCH] Thu Jul 13 19:31:00 CST 2023 inscode
---
src/App.vue | 15 ++++++++++-----
src/js/openai.js | 3 ++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 22dffa6..0defdf5 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 0781473..33a2efa 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 {
--
GitLab