mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Secrets: Add find endpoint
Requires the user to set allowKeysExposure to true before any calls can work. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@ -116,6 +116,23 @@ export async function readSecretState() {
|
||||
}
|
||||
}
|
||||
|
||||
export async function findSecret(key) {
|
||||
try {
|
||||
const response = await fetch('/api/secrets/find', {
|
||||
method: 'POST',
|
||||
headers: getRequestHeaders(),
|
||||
body: JSON.stringify({ key }),
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
return data.value
|
||||
}
|
||||
} catch {
|
||||
console.error('Could not find secret value: ', key);
|
||||
}
|
||||
}
|
||||
|
||||
function authorizeOpenRouter() {
|
||||
const openRouterUrl = `https://openrouter.ai/auth?callback_url=${encodeURIComponent(location.origin)}`;
|
||||
location.href = openRouterUrl;
|
||||
|
Reference in New Issue
Block a user