adds eslint

This commit is contained in:
geoffsee
2025-06-24 17:29:52 -04:00
committed by Geoff Seemueller
parent 9698fc6f3b
commit 02c3253343
169 changed files with 4896 additions and 4804 deletions

View File

@@ -1,5 +1,6 @@
import { Utils } from "./utils";
import few_shots from "../prompts/few_shots";
import few_shots from '../prompts/few_shots';
import { Utils } from './utils';
export class AssistantSdk {
static getAssistantPrompt(params: {
@@ -7,11 +8,7 @@ export class AssistantSdk {
userTimezone?: string;
userLocation?: string;
}): string {
const {
maxTokens,
userTimezone = "UTC",
userLocation = "",
} = params;
const { maxTokens, userTimezone = 'UTC', userLocation = '' } = params;
// console.log('[DEBUG_LOG] few_shots:', JSON.stringify(few_shots));
let selectedFewshots = Utils.selectEquitably?.(few_shots);
// console.log('[DEBUG_LOG] selectedFewshots after Utils.selectEquitably:', JSON.stringify(selectedFewshots));
@@ -20,18 +17,18 @@ export class AssistantSdk {
// console.log('[DEBUG_LOG] selectedFewshots after fallback:', JSON.stringify(selectedFewshots));
}
const sdkDate = new Date().toISOString();
const [currentDate] = sdkDate.includes("T") ? sdkDate.split("T") : [sdkDate];
const [currentDate] = sdkDate.includes('T') ? sdkDate.split('T') : [sdkDate];
const now = new Date();
const formattedMinutes = String(now.getMinutes()).padStart(2, "0");
const formattedMinutes = String(now.getMinutes()).padStart(2, '0');
const currentTime = `${now.getHours()}:${formattedMinutes} ${now.getSeconds()}s`;
return `# Assistant Knowledge
## Current Context
### Date: ${currentDate} ${currentTime}
### Web Host: open-gsio.seemueller.workers.dev
${maxTokens ? `### Max Response Length: ${maxTokens} tokens (maximum)` : ""}
${maxTokens ? `### Max Response Length: ${maxTokens} tokens (maximum)` : ''}
### Lexicographical Format: Markdown
### User Location: ${userLocation || "Unknown"}
### User Location: ${userLocation || 'Unknown'}
### Timezone: ${userTimezone}
## Response Framework
1. Use knowledge provided in the current context as the primary source of truth.
@@ -51,11 +48,9 @@ Continuously monitor the evolving conversation. Dynamically adapt each response.
static useFewshots(fewshots: Record<string, string>, limit = 5): string {
return Object.entries(fewshots)
.slice(0, limit)
.map(
([q, a], i) => {
return `#### Example ${i + 1}\n**Human**: ${q}\n**Assistant**: ${a}`
}
)
.join("\n---\n");
.map(([q, a], i) => {
return `#### Example ${i + 1}\n**Human**: ${q}\n**Assistant**: ${a}`;
})
.join('\n---\n');
}
}