mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-15 12:03:55 +00:00
no message
This commit is contained in:
parent
201c0e086b
commit
be94c816ca
@ -653,7 +653,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.msgSubscribe = Store.subscribe('dialogMsgUpdate', this.updateMsg);
|
this.msgSubscribe = Store.subscribe('dialogMsgChange', this.onMsgChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
@ -1343,11 +1343,15 @@ export default {
|
|||||||
this.sendMsg(`<p><span data-quick-key="${item.key}">${item.label}</span></p>`)
|
this.sendMsg(`<p><span data-quick-key="${item.key}">${item.label}</span></p>`)
|
||||||
},
|
},
|
||||||
|
|
||||||
updateMsg(data) {
|
onMsgChange(data) {
|
||||||
const item = this.allMsgs.find(({type, id}) => type == "text" && id == data.id)
|
const item = this.allMsgs.find(({type, id}) => type == "text" && id == data.id)
|
||||||
if (item) {
|
if (item) {
|
||||||
const {tail} = this.scrollInfo()
|
const {tail} = this.scrollInfo()
|
||||||
item.msg.text = data.text
|
if (data.type === 'append') {
|
||||||
|
item.msg.text += data.text
|
||||||
|
} else if (data.type === 'replace') {
|
||||||
|
item.msg.text = data.text
|
||||||
|
}
|
||||||
if (tail <= 45) {
|
if (tail <= 45) {
|
||||||
this.onToBottom()
|
this.onToBottom()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,24 +2,28 @@
|
|||||||
<div class="setting-component-item">
|
<div class="setting-component-item">
|
||||||
<Form ref="formData" :model="formData" :rules="ruleData" label-width="auto" @submit.native.prevent>
|
<Form ref="formData" :model="formData" :rules="ruleData" label-width="auto" @submit.native.prevent>
|
||||||
<div class="block-setting-box">
|
<div class="block-setting-box">
|
||||||
<h3>{{ $L('ChatGTP') }}</h3>
|
<h3>ChatGTP</h3>
|
||||||
<div class="form-box">
|
<div class="form-box">
|
||||||
<FormItem label="Key" prop="openai_key">
|
<FormItem label="API Key" prop="openai_key">
|
||||||
<Input :maxlength="255" v-model="formData.openai_key"/>
|
<Input :maxlength="255" v-model="formData.openai_key" placeholder="OpenAI API Key"/>
|
||||||
|
<div class="form-tip">{{$L('访问OpenAI网站查看:')}}<a href="https://platform.openai.com/account/api-keys" target="_blank">https://platform.openai.com/account/api-keys</a></div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('使用代理')" prop="openai_agency">
|
<FormItem :label="$L('使用代理')" prop="openai_agency">
|
||||||
<Input :maxlength="500" v-model="formData.openai_agency" :placeholder="$L('支持 http 或 socks 代理')"/>
|
<Input :maxlength="500" v-model="formData.openai_agency" :placeholder="$L('支持 http 或 socks 代理')"/>
|
||||||
|
<div class="form-tip">{{$L('例如:http://proxy.com 或 socks5://proxy.com')}}</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="block-setting-box">
|
<div class="block-setting-box">
|
||||||
<h3>{{ $L('Claude') }}</h3>
|
<h3>Claude</h3>
|
||||||
<div class="form-box">
|
<div class="form-box">
|
||||||
<FormItem label="Token" prop="claude_token">
|
<FormItem label="Token" prop="claude_token">
|
||||||
<Input :maxlength="255" v-model="formData.claude_token"/>
|
<Input :maxlength="255" v-model="formData.claude_token" placeholder="Claude Token"/>
|
||||||
|
<div class="form-tip">{{$L('登录')}} <a href="https://claude.ai" target="_blank">https://claude.ai</a> {{$L('查看 Cookie 中的 sessionKey 便是')}}</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('使用代理')" prop="claude_agency">
|
<FormItem :label="$L('使用代理')" prop="claude_agency">
|
||||||
<Input :maxlength="500" v-model="formData.claude_agency" :placeholder="$L('支持 http 或 socks 代理')"/>
|
<Input :maxlength="500" v-model="formData.claude_agency" :placeholder="$L('支持 http 或 socks 代理')"/>
|
||||||
|
<div class="form-tip">{{$L('例如:http://proxy.com 或 socks5://proxy.com')}}</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
12
resources/assets/js/store/actions.js
vendored
12
resources/assets/js/store/actions.js
vendored
@ -2851,9 +2851,17 @@ export default {
|
|||||||
*/
|
*/
|
||||||
streamDialogMsg({state, dispatch}, streamUrl) {
|
streamDialogMsg({state, dispatch}, streamUrl) {
|
||||||
const sse = new EventSource(streamUrl)
|
const sse = new EventSource(streamUrl)
|
||||||
sse.addEventListener("update", e => {
|
sse.addEventListener("append", e => {
|
||||||
Store.set('dialogMsgUpdate', {
|
Store.set('dialogMsgChange', {
|
||||||
id: e.lastEventId,
|
id: e.lastEventId,
|
||||||
|
type: 'append',
|
||||||
|
text: e.data
|
||||||
|
});
|
||||||
|
})
|
||||||
|
sse.addEventListener("replace", e => {
|
||||||
|
Store.set('dialogMsgChange', {
|
||||||
|
id: e.lastEventId,
|
||||||
|
type: 'replace',
|
||||||
text: e.data
|
text: e.data
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user