Add CORS proxy to system prompt

This commit is contained in:
Alex Gleason committed 2025-11-11 18:03:21 -06:00
1 parent e116f7e9ec
commit 35a85c18bd
2 files changed
+16 -1

No files matched your search

+1
View File
@@ -248,6 +248,7 @@ export class SessionManager {
pluginsPath: this.pluginsPath,
user,
metadata,
corsProxy: this.corsProxy,
});
// Prepare messages for AI
+15 -1
View File
@@ -16,10 +16,11 @@ export interface MakeSystemPromptOpts {
pluginsPath?: string;
user?: NUser;
metadata?: NostrMetadata;
corsProxy?: string;
}
export async function makeSystemPrompt(opts: MakeSystemPromptOpts): Promise<string> {
const { name, profession, tools, mode, fs, cwd, pluginsPath, user, metadata } = opts;
const { name, profession, tools, mode, fs, cwd, pluginsPath, user, metadata, corsProxy } = opts;
let system = mode === "init"
? `You are ${name}, an expert ${profession}. The files in the current directory are a template. Your goal is to transform this template into a working project according to the user's request.`
@@ -210,6 +211,19 @@ The user expects you to handle all technical implementation while they focus on
system += `\nUsers can configure skills in Settings > AI (${location.origin}/settings/ai) by adding plugins that contain skills.`;
// Add CORS proxy information
if (corsProxy) {
system += `
## Working Around CORS Issues
If you encounter CORS (Cross-Origin Resource Sharing) errors when fetching external APIs, use the configured CORS proxy:
**CORS Proxy URL Template**: \`${corsProxy}\`
Replace \`{href}\`, \`{hostname}\`, or other URL components in the template as needed.`;
}
// Add README.md if it exists
try {
const readmePath = join(cwd, "README.md");