mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 18:16:08 +00:00
feat(websearch): inject hooks on profile creation
Add hook injection at profile creation time (not just runtime): - profile-writer.ts: inject on API profile create/update - variant-settings.ts: inject on CLIProxy variant create Hooks now present immediately after profile creation.
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
saveUnifiedConfig,
|
saveUnifiedConfig,
|
||||||
isUnifiedMode,
|
isUnifiedMode,
|
||||||
} from '../../config/unified-config-loader';
|
} from '../../config/unified-config-loader';
|
||||||
|
import { ensureProfileHooks } from '../../utils/websearch/profile-hook-injector';
|
||||||
import type { ModelMapping, CreateApiProfileResult, RemoveApiProfileResult } from './profile-types';
|
import type { ModelMapping, CreateApiProfileResult, RemoveApiProfileResult } from './profile-types';
|
||||||
|
|
||||||
/** Check if URL is an OpenRouter endpoint */
|
/** Check if URL is an OpenRouter endpoint */
|
||||||
@@ -43,6 +44,10 @@ function createSettingsFile(
|
|||||||
};
|
};
|
||||||
|
|
||||||
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
||||||
|
|
||||||
|
// Inject WebSearch hooks into profile settings
|
||||||
|
ensureProfileHooks(name);
|
||||||
|
|
||||||
return settingsPath;
|
return settingsPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +106,9 @@ function createApiProfileUnified(
|
|||||||
|
|
||||||
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
||||||
|
|
||||||
|
// Inject WebSearch hooks into profile settings
|
||||||
|
ensureProfileHooks(name);
|
||||||
|
|
||||||
const config = loadOrCreateUnifiedConfig();
|
const config = loadOrCreateUnifiedConfig();
|
||||||
config.profiles[name] = {
|
config.profiles[name] = {
|
||||||
type: 'api',
|
type: 'api',
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { getCcsDir } from '../../utils/config-manager';
|
|||||||
import { expandPath } from '../../utils/helpers';
|
import { expandPath } from '../../utils/helpers';
|
||||||
import { getClaudeEnvVars, CLIPROXY_DEFAULT_PORT } from '../config-generator';
|
import { getClaudeEnvVars, CLIPROXY_DEFAULT_PORT } from '../config-generator';
|
||||||
import { CLIProxyProvider } from '../types';
|
import { CLIProxyProvider } from '../types';
|
||||||
|
import { ensureProfileHooks } from '../../utils/websearch/profile-hook-injector';
|
||||||
|
|
||||||
/** Environment settings structure */
|
/** Environment settings structure */
|
||||||
interface SettingsEnv {
|
interface SettingsEnv {
|
||||||
@@ -105,6 +106,9 @@ export function createSettingsFile(
|
|||||||
ensureDir(ccsDir);
|
ensureDir(ccsDir);
|
||||||
writeSettings(settingsPath, settings);
|
writeSettings(settingsPath, settings);
|
||||||
|
|
||||||
|
// Inject WebSearch hooks into variant settings
|
||||||
|
ensureProfileHooks(`${provider}-${name}`);
|
||||||
|
|
||||||
return settingsPath;
|
return settingsPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +131,9 @@ export function createSettingsFileUnified(
|
|||||||
ensureDir(ccsDir);
|
ensureDir(ccsDir);
|
||||||
writeSettings(settingsPath, settings);
|
writeSettings(settingsPath, settings);
|
||||||
|
|
||||||
|
// Inject WebSearch hooks into variant settings
|
||||||
|
ensureProfileHooks(`${provider}-${name}`);
|
||||||
|
|
||||||
return settingsPath;
|
return settingsPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user