Merge pull request #4813 from splatch/apply-request-options-for-completion-models
Carry over requestOptions from config to completion modles
This commit is contained in:
commit
dafb8d12e8
1 changed files with 26 additions and 8 deletions
|
|
@ -203,6 +203,24 @@ async function serializedToIntermediateConfig(
|
|||
return config;
|
||||
}
|
||||
|
||||
// Merge request options set for entire config with model specific options
|
||||
function applyRequestOptionsToModels(
|
||||
models: BaseLLM[],
|
||||
config: Config,
|
||||
roles: ModelRole[] | undefined = undefined,
|
||||
) {
|
||||
// Prepare models
|
||||
for (const model of models) {
|
||||
model.requestOptions = {
|
||||
...model.requestOptions,
|
||||
...config.requestOptions,
|
||||
};
|
||||
if (roles !== undefined) {
|
||||
model.roles = model.roles ?? roles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isContextProviderWithParams(
|
||||
contextProvider: CustomContextProvider | ContextProviderWithParams,
|
||||
): contextProvider is ContextProviderWithParams {
|
||||
|
|
@ -311,14 +329,12 @@ async function intermediateToFinalConfig({
|
|||
}),
|
||||
);
|
||||
|
||||
// Prepare models
|
||||
for (const model of models) {
|
||||
model.requestOptions = {
|
||||
...model.requestOptions,
|
||||
...config.requestOptions,
|
||||
};
|
||||
model.roles = model.roles ?? ["chat", "apply", "edit", "summarize"]; // Default to chat role if not specified
|
||||
}
|
||||
applyRequestOptionsToModels(models, config, [
|
||||
"chat",
|
||||
"apply",
|
||||
"edit",
|
||||
"summarize",
|
||||
]); // Default to chat role if not specified
|
||||
|
||||
if (allowFreeTrial) {
|
||||
// Obtain auth token (iff free trial being used)
|
||||
|
|
@ -372,6 +388,8 @@ async function intermediateToFinalConfig({
|
|||
).filter((x) => x !== undefined) as BaseLLM[];
|
||||
}
|
||||
|
||||
applyRequestOptionsToModels(tabAutocompleteModels, config);
|
||||
|
||||
// These context providers are always included, regardless of what, if anything,
|
||||
// the user has configured in config.json
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue