Merge d8eca4d82e
into 6eecde3cc8
This commit is contained in:
commit
67eb5ea7f1
3 changed files with 14 additions and 4 deletions
Binary file not shown.
|
@ -159,7 +159,7 @@
|
|||
id="msg-input"
|
||||
dir="auto"
|
||||
></textarea>
|
||||
<button v-if="!isGenerating" class="btn btn-primary ml-2" @click="sendMessage" :disabled="inputMsg.length === 0">Send</button>
|
||||
<button v-if="!isGenerating" class="btn btn-primary ml-2" @click="sendMessage" :disabled="inputMsg.length === 0" id="msg-send">Send</button>
|
||||
<button v-else class="btn btn-neutral ml-2" @click="stopGeneration">Stop</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import './styles.scss';
|
||||
import { createApp, defineComponent, shallowRef, computed, h } from 'vue/dist/vue.esm-bundler.js';
|
||||
import { createApp, defineComponent, shallowRef, computed, h, nextTick } from 'vue/dist/vue.esm-bundler.js';
|
||||
import MarkdownIt from 'markdown-it';
|
||||
import TextLineStream from 'textlinestream';
|
||||
|
||||
|
@ -373,6 +373,10 @@ async function* sendSSEPostRequest(url, fetchOptions) {
|
|||
}
|
||||
};
|
||||
|
||||
const usp = new URLSearchParams (window.location.search);
|
||||
const initial_query = usp.get ('q');
|
||||
const initial_msg = initial_query || usp.get ('m') || '';
|
||||
|
||||
const mainApp = createApp({
|
||||
components: {
|
||||
VueMarkdown,
|
||||
|
@ -385,7 +389,7 @@ const mainApp = createApp({
|
|||
/** @type {Array<Message>} */
|
||||
messages: [],
|
||||
viewingConvId: StorageUtils.getNewConvId(),
|
||||
inputMsg: '',
|
||||
inputMsg: initial_msg,
|
||||
isGenerating: false,
|
||||
/** @type {Array<Message> | null} */
|
||||
pendingMsg: null, // the on-going message from assistant
|
||||
|
@ -660,7 +664,13 @@ const mainApp = createApp({
|
|||
});
|
||||
mainApp.config.errorHandler = alert;
|
||||
try {
|
||||
mainApp.mount('#app');
|
||||
const appInstance = mainApp.mount('#app');
|
||||
nextTick().then(() => {
|
||||
if (initial_query)
|
||||
appInstance.sendMessage();
|
||||
else if (initial_msg)
|
||||
setTimeout(() => document.getElementById('msg-input').focus(), 1);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
document.getElementById('app').innerHTML = `<div style="margin:2em auto">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue