mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-14 19:50:50 +00:00
no message
This commit is contained in:
parent
201c0e086b
commit
be94c816ca
@ -653,7 +653,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.msgSubscribe = Store.subscribe('dialogMsgUpdate', this.updateMsg);
|
||||
this.msgSubscribe = Store.subscribe('dialogMsgChange', this.onMsgChange);
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
@ -1343,11 +1343,15 @@ export default {
|
||||
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)
|
||||
if (item) {
|
||||
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) {
|
||||
this.onToBottom()
|
||||
}
|
||||
|
||||
@ -2,24 +2,28 @@
|
||||
<div class="setting-component-item">
|
||||
<Form ref="formData" :model="formData" :rules="ruleData" label-width="auto" @submit.native.prevent>
|
||||
<div class="block-setting-box">
|
||||
<h3>{{ $L('ChatGTP') }}</h3>
|
||||
<h3>ChatGTP</h3>
|
||||
<div class="form-box">
|
||||
<FormItem label="Key" prop="openai_key">
|
||||
<Input :maxlength="255" v-model="formData.openai_key"/>
|
||||
<FormItem label="API Key" prop="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 :label="$L('使用代理')" prop="openai_agency">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block-setting-box">
|
||||
<h3>{{ $L('Claude') }}</h3>
|
||||
<h3>Claude</h3>
|
||||
<div class="form-box">
|
||||
<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 :label="$L('使用代理')" prop="claude_agency">
|
||||
<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>
|
||||
</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) {
|
||||
const sse = new EventSource(streamUrl)
|
||||
sse.addEventListener("update", e => {
|
||||
Store.set('dialogMsgUpdate', {
|
||||
sse.addEventListener("append", e => {
|
||||
Store.set('dialogMsgChange', {
|
||||
id: e.lastEventId,
|
||||
type: 'append',
|
||||
text: e.data
|
||||
});
|
||||
})
|
||||
sse.addEventListener("replace", e => {
|
||||
Store.set('dialogMsgChange', {
|
||||
id: e.lastEventId,
|
||||
type: 'replace',
|
||||
text: e.data
|
||||
});
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user