mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 05:39:12 +00:00
Fix auto resizing chat input box when transcribed text added
This commit is contained in:
@@ -690,7 +690,7 @@
|
|||||||
|
|
||||||
fetch(url, { method: 'POST', body: formData, headers})
|
fetch(url, { method: 'POST', body: formData, headers})
|
||||||
.then(response => response.ok ? response.json() : Promise.reject(response))
|
.then(response => response.ok ? response.json() : Promise.reject(response))
|
||||||
.then(data => { chatInput.value += data.text; })
|
.then(data => { chatInput.value += data.text.trimStart(); autoResize(); })
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err.status === 501) {
|
if (err.status === 501) {
|
||||||
flashStatusInChatInput("⛔️ Configure speech-to-text model on server.")
|
flashStatusInChatInput("⛔️ Configure speech-to-text model on server.")
|
||||||
@@ -917,7 +917,8 @@
|
|||||||
grid-template-columns: 32px auto 32px 40px;
|
grid-template-columns: 32px auto 32px 40px;
|
||||||
grid-column-gap: 10px;
|
grid-column-gap: 10px;
|
||||||
grid-row-gap: 10px;
|
grid-row-gap: 10px;
|
||||||
background: #f9fafc
|
background: #f9fafc;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.option:hover {
|
.option:hover {
|
||||||
box-shadow: 0 0 11px #aaa;
|
box-shadow: 0 0 11px #aaa;
|
||||||
|
|||||||
@@ -453,7 +453,8 @@ export class KhojChatModal extends Modal {
|
|||||||
// Parse response from Khoj backend
|
// Parse response from Khoj backend
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
chatInput.value += response.json.text;
|
chatInput.value += response.json.text.trimStart();
|
||||||
|
this.autoResize();
|
||||||
} else if (response.status === 501) {
|
} else if (response.status === 501) {
|
||||||
throw new Error("⛔️ Configure speech-to-text model on server.");
|
throw new Error("⛔️ Configure speech-to-text model on server.");
|
||||||
} else if (response.status === 422) {
|
} else if (response.status === 422) {
|
||||||
|
|||||||
@@ -235,6 +235,7 @@ img {
|
|||||||
grid-row-gap: 10px;
|
grid-row-gap: 10px;
|
||||||
background: var(--background-primary);
|
background: var(--background-primary);
|
||||||
margin: 0 0 0 -8px;
|
margin: 0 0 0 -8px;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
#khoj-chat-input.option:hover {
|
#khoj-chat-input.option:hover {
|
||||||
box-shadow: 0 0 11px var(--background-modifier-box-shadow);
|
box-shadow: 0 0 11px var(--background-modifier-box-shadow);
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||||||
|
|
||||||
fetch('/api/transcribe?client=web', { method: 'POST', body: formData })
|
fetch('/api/transcribe?client=web', { method: 'POST', body: formData })
|
||||||
.then(response => response.ok ? response.json() : Promise.reject(response))
|
.then(response => response.ok ? response.json() : Promise.reject(response))
|
||||||
.then(data => { chatInput.value += data.text; })
|
.then(data => { chatInput.value += data.text.trimStart(); autoResize(); })
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err.status === 501) {
|
if (err.status === 501) {
|
||||||
flashStatusInChatInput("⛔️ Configure speech-to-text model on server.")
|
flashStatusInChatInput("⛔️ Configure speech-to-text model on server.")
|
||||||
@@ -987,6 +987,7 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||||||
grid-column-gap: 10px;
|
grid-column-gap: 10px;
|
||||||
grid-row-gap: 10px;
|
grid-row-gap: 10px;
|
||||||
background: var(--background-color);
|
background: var(--background-color);
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.option:hover {
|
.option:hover {
|
||||||
box-shadow: 0 0 11px #aaa;
|
box-shadow: 0 0 11px #aaa;
|
||||||
|
|||||||
Reference in New Issue
Block a user