mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix sampling params
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import type {
|
||||
ContentGeneratorConfig,
|
||||
FileFilteringOptions,
|
||||
MCPServerConfig,
|
||||
OutputFormat,
|
||||
@@ -123,6 +124,24 @@ export interface CliArgs {
|
||||
outputFormat: string | undefined;
|
||||
}
|
||||
|
||||
type LegacySamplingSettings = {
|
||||
sampling_params?: ContentGeneratorConfig['samplingParams'];
|
||||
};
|
||||
|
||||
function getLegacySamplingParams(
|
||||
settings: Settings,
|
||||
): ContentGeneratorConfig['samplingParams'] | undefined {
|
||||
if (
|
||||
typeof settings !== 'object' ||
|
||||
settings === null ||
|
||||
!('sampling_params' in (settings as Record<string, unknown>))
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return (settings as Settings & LegacySamplingSettings).sampling_params;
|
||||
}
|
||||
|
||||
export async function parseArguments(settings: Settings): Promise<CliArgs> {
|
||||
const rawArgv = hideBin(process.argv);
|
||||
const yargsInstance = yargs(rawArgv)
|
||||
@@ -685,6 +704,7 @@ export async function loadCliConfig(
|
||||
|
||||
const vlmSwitchMode =
|
||||
argv.vlmSwitchMode || settings.experimental?.vlmSwitchMode;
|
||||
const legacySamplingParams = getLegacySamplingParams(settings);
|
||||
return new Config({
|
||||
sessionId,
|
||||
embeddingModel: DEFAULT_QWEN_EMBEDDING_MODEL,
|
||||
@@ -745,6 +765,8 @@ export async function loadCliConfig(
|
||||
(typeof argv.openaiLogging === 'undefined'
|
||||
? settings.model?.enableOpenAILogging
|
||||
: argv.openaiLogging) ?? false,
|
||||
// Include sampling_params from root level settings
|
||||
...(legacySamplingParams ? { samplingParams: legacySamplingParams } : {}),
|
||||
},
|
||||
cliVersion: await getCliVersion(),
|
||||
tavilyApiKey:
|
||||
|
||||
Reference in New Issue
Block a user