mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Add CORS proxy to system prompt
This commit is contained in:
2 files changed
+16
-1
No files matched your search
@@ -248,6 +248,7 @@ export class SessionManager {
|
||||
pluginsPath: this.pluginsPath,
|
||||
user,
|
||||
metadata,
|
||||
corsProxy: this.corsProxy,
|
||||
});
|
||||
|
||||
// Prepare messages for AI
|
||||
|
||||
+15
-1
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user