mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 05:39:12 +00:00
Rename /api/speak API endpoint to /api/transcribe
This commit is contained in:
@@ -555,7 +555,7 @@
|
|||||||
const chatInput = document.getElementById('chat-input');
|
const chatInput = document.getElementById('chat-input');
|
||||||
|
|
||||||
const hostURL = await window.hostURLAPI.getURL();
|
const hostURL = await window.hostURLAPI.getURL();
|
||||||
let url = `${hostURL}/api/speak?client=desktop`;
|
let url = `${hostURL}/api/transcribe?client=desktop`;
|
||||||
const khojToken = await window.tokenAPI.getToken();
|
const khojToken = await window.tokenAPI.getToken();
|
||||||
const headers = { 'Authorization': `Bearer ${khojToken}` };
|
const headers = { 'Authorization': `Bearer ${khojToken}` };
|
||||||
|
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ export class KhojChatModal extends Modal {
|
|||||||
const requestBody = await generateRequestBody(audioBlob, boundary_string);
|
const requestBody = await generateRequestBody(audioBlob, boundary_string);
|
||||||
|
|
||||||
const response = await requestUrl({
|
const response = await requestUrl({
|
||||||
url: `${this.setting.khojUrl}/api/speak?client=obsidian`,
|
url: `${this.setting.khojUrl}/api/transcribe?client=obsidian`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { "Authorization": `Bearer ${this.setting.khojApiKey}` },
|
headers: { "Authorization": `Bearer ${this.setting.khojApiKey}` },
|
||||||
contentType: `multipart/form-data; boundary=----${boundary_string}`,
|
contentType: `multipart/form-data; boundary=----${boundary_string}`,
|
||||||
|
|||||||
@@ -581,7 +581,7 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', audioBlob);
|
formData.append('file', audioBlob);
|
||||||
|
|
||||||
fetch('/api/speak?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; })
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ async def chat_options(
|
|||||||
return Response(content=json.dumps(cmd_options), media_type="application/json", status_code=200)
|
return Response(content=json.dumps(cmd_options), media_type="application/json", status_code=200)
|
||||||
|
|
||||||
|
|
||||||
@api.post("/speak")
|
@api.post("/transcribe")
|
||||||
@requires(["authenticated"])
|
@requires(["authenticated"])
|
||||||
async def transcribe(request: Request, common: CommonQueryParams, file: UploadFile = File(...)):
|
async def transcribe(request: Request, common: CommonQueryParams, file: UploadFile = File(...)):
|
||||||
user: KhojUser = request.user.object
|
user: KhojUser = request.user.object
|
||||||
|
|||||||
Reference in New Issue
Block a user