Skip to content

Commit

Permalink
pass auth token to bot in body (#7108)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianjelfs authored Dec 21, 2024
1 parent e323b2c commit ba84c49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions frontend/app/src/components/bots/CommandSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
}
function selectCommand(command: FlattenedCommand) {
setSelectedCommand(command);
setSelectedCommand(commands, command);
sendCommandIfValid();
}
Expand Down Expand Up @@ -180,7 +180,7 @@
break;
case "Enter":
if (!$showingBuilder) {
setSelectedCommand();
setSelectedCommand(commands);
sendCommandIfValid();
}
break;
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/src/components/bots/botState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ export function createBotInstance(
}
}

export function setSelectedCommand(cmd?: FlattenedCommand) {
cmd = cmd ?? get(commands)[get(focusedCommandIndex)];
export function setSelectedCommand(commands: FlattenedCommand[], cmd?: FlattenedCommand) {
cmd = cmd ?? commands[get(focusedCommandIndex)];

// make sure that we don't set the same command twice
if (!commandsMatch(get(selectedCommand), cmd)) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/openchat-client/src/openchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7757,11 +7757,11 @@ export class OpenChat extends EventTarget {

#callBotCommandEndpoint(bot: ExternalBotCommandInstance, token: string): Promise<unknown> {
const headers = new Headers();
headers.append("x-auth-jwt", token);
headers.append("Content-type", "application/json");
headers.append("Content-type", "text/plain");
return fetch(`${bot.endpoint}/execute_command`, {
method: "POST",
headers: headers,
body: token,
}).then((res) => {
if (res.ok) {
return res.json();
Expand Down

0 comments on commit ba84c49

Please sign in to comment.