re-adds keychecker info to STATIC_INFO_PAGE

This commit is contained in:
nai-degen
2023-11-16 02:16:24 -06:00
parent bfd7e23124
commit e018672968
2 changed files with 12 additions and 8 deletions
+2 -1
View File
@@ -173,7 +173,7 @@ type Config = {
useInsecureCookies: boolean;
/**
* Whether to use a more minimal public Service Info page with static content.
* This disables all stats, including traffic, keys, and queue info.
* Disables all stats pertaining to traffic, prompt/token usage, and queues.
* The full info page will appear if you have signed in as an admin using the
* configured ADMIN_KEY and go to /admin/service-info.
**/
@@ -368,6 +368,7 @@ export const OMITTED_KEYS: (keyof Config)[] = [
"showRecentImages",
"useInsecureCookies",
"staticServiceInfo",
"checkKeys",
];
const getKeys = Object.keys as <T extends object>(obj: T) => Array<keyof T>;
+10 -7
View File
@@ -120,18 +120,21 @@ export function buildInfoPageHtml(baseUrl: string, asAdmin = false) {
...(config.textModelRateLimit ? { proomptersNow: getUniqueIps() } : {}),
};
const keyInfo = {
openaiKeys,
anthropicKeys,
palmKeys,
awsKeys,
};
const keyInfo = { openaiKeys, anthropicKeys, palmKeys, awsKeys };
const providerInfo = {
...(openaiKeys ? getOpenAIInfo() : {}),
...(anthropicKeys ? getAnthropicInfo() : {}),
...(palmKeys ? { "palm-bison": getPalmInfo() } : {}),
...(awsKeys ? { "aws-claude": getAwsInfo() } : {}),
};
if (hideFullInfo) {
for (const provider of Object.keys(providerInfo)) {
delete (providerInfo as any)[provider].proomptersInQueue;
delete (providerInfo as any)[provider].estimatedQueueTime;
delete (providerInfo as any)[provider].usage;
}
}
const info = {
@@ -139,7 +142,7 @@ export function buildInfoPageHtml(baseUrl: string, asAdmin = false) {
endpoints,
...(hideFullInfo ? {} : stats),
...keyInfo,
...(hideFullInfo ? {} : providerInfo),
...providerInfo,
config: listConfig(),
build: process.env.BUILD_INFO || "dev",
};