Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass auth token to bot in body #7108

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading