Fri Jul 7 08:01:01 UTC 2023 inscode

上级 c64e1cdd
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
<t-form labelAlign="top"> <t-form labelAlign="top">
<t-form-item label="StableDiffusion服务器类型" name="sdServerType"> <t-form-item label="StableDiffusion服务器类型" name="sdServerType">
<t-select v-model="sdServerType" @change="handleSDServerTypeChange"> <t-select v-model="sdServerType" @change="handleSDServerTypeChange" class="bg-gray-200" style="background: #ccc;font-size:12px;">
<t-option v-for="(item, index) in sdServerTypeOptions" :key="index" :value="item.value" :label="item.label"> <t-option v-for="(item, index) in sdServerTypeOptions" :key="index" :value="item.value" :label="item.label">
{{ item.label }} {{ item.label }}
</t-option> </t-option>
</t-select> </t-select>
</t-form-item> </t-form-item>
<t-form-item label="服务器地址" name="sdServerUrl"> <t-form-item label="服务器地址" name="sdServerUrl">
<t-textarea placeholder="请输入内容" v-model="sdServerUrl" :autosize="true"/> <t-textarea placeholder="请输入内容" v-model="sdServerUrl" :autosize="true" @change="saveConfig"/>
</t-form-item> </t-form-item>
</t-form> </t-form>
<t-card class="bg-orange-100 mt-8 text-gray-600 text-sm" v-if="sdServerType === 'common'"> <t-card class="bg-orange-100 mt-8 text-gray-600 text-sm" v-if="sdServerType === 'common'">
...@@ -192,7 +192,7 @@ export default { ...@@ -192,7 +192,7 @@ export default {
{ label: '公共服务器', value: 'common' }, { label: '公共服务器', value: 'common' },
{ label: '私有服务器', value: 'private' }, { label: '私有服务器', value: 'private' },
], ],
sdServerUrl: 'https://gpu-pod64a4ff02b54fe048c07abc40-6006.node.inscode.run/sdapi/v1/txt2img', sdServerUrl: '',
loading: false, loading: false,
maxHistory: 200, maxHistory: 200,
speaking: false, // 是否正在输出语音 speaking: false, // 是否正在输出语音
...@@ -313,7 +313,11 @@ export default { ...@@ -313,7 +313,11 @@ export default {
const negative_prompt = this.negative_prompt const negative_prompt = this.negative_prompt
const _this = this const _this = this
const messages = this.message const messages = this.message
messages.push({ "user": "User", "message": 'prompt: <br/>' + this.prompt + (negative_prompt ? '<br/>' + 'negative_prompt: </br>' + negative_prompt : '') }) const content = 'prompt: <br/>' +
this.prompt +
(negative_prompt ? '<br/><br/>' + 'negative_prompt: </br>' + negative_prompt : '') + '<br/><br/>' +
'width: ' + this.width + ' height: ' + this.height + '<br/>steps: ' + this.steps +'<br/>sampler: ' + this.sampler
messages.push({ "user": "User", "message": content })
messages.push(currentMsg) messages.push(currentMsg)
...@@ -473,13 +477,12 @@ export default { ...@@ -473,13 +477,12 @@ export default {
copyAsPrompt (message) { copyAsPrompt (message) {
this.prompt = message this.prompt = message
}, },
handleServerTypeChange (type) { handleSDServerTypeChange (type) {
if (type === 'common') { if (type === 'common') {
this.sdServerUrl = this.config.common_sd_api this.sdServerUrl = this.config.common_sd_api
} }
this.saveConfig()
console.info(123)
}, },
recoverConfig () { recoverConfig () {
const config = localStorage.getItem('ai-config') const config = localStorage.getItem('ai-config')
...@@ -488,10 +491,16 @@ export default { ...@@ -488,10 +491,16 @@ export default {
this.config = configJSON this.config = configJSON
this.sdServerType = configJSON.sdServerType this.sdServerType = configJSON.sdServerType
this.sdServerUrl = configJSON.sdServerUrl this.sdServerUrl = configJSON.sdServerUrl
this.sdServerType = configJSON.sdServerType??'common'
const data = Config.getData().data
this.name = data.name
document.title = this.name
} else { } else {
this.getAppInfo() this.getAppInfo()
this.sdServerUrl = this.config.common_sd_api this.sdServerUrl = this.config.common_sd_api
this.sdServerType = 'common'
} }
}, },
...@@ -500,6 +509,7 @@ export default { ...@@ -500,6 +509,7 @@ export default {
const config = JSON.parse(JSON.stringify(this.config)) const config = JSON.parse(JSON.stringify(this.config))
config.sdServerType = this.sdServerType config.sdServerType = this.sdServerType
config.sdServerUrl = this.sdServerUrl config.sdServerUrl = this.sdServerUrl
config.sdServerType = this.sdServerType
localStorage.setItem('ai-config', JSON.stringify(config)) localStorage.setItem('ai-config', JSON.stringify(config))
} }
}, },
......
...@@ -4,7 +4,7 @@ export default { ...@@ -4,7 +4,7 @@ export default {
"code": 200, "code": 200,
"data": { "data": {
"id": 128897, "id": 128897,
"name": "小羊驼", "name": "AI绘图",
"create_time": 1684920670901, "create_time": 1684920670901,
"app": "llm_rep", "app": "llm_rep",
"resource_type": "app", "resource_type": "app",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册