mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
fix: address latest Greptile runtime review
This commit is contained in:
parent
55b26ed590
commit
c8f8f6752f
7 changed files with 177 additions and 12 deletions
|
|
@ -1702,6 +1702,8 @@ export function agentRoutes(db: Db) {
|
|||
}
|
||||
|
||||
const patchData = { ...(req.body as Record<string, unknown>) };
|
||||
const replaceAdapterConfig = patchData.replaceAdapterConfig === true;
|
||||
delete patchData.replaceAdapterConfig;
|
||||
if (Object.prototype.hasOwnProperty.call(patchData, "adapterConfig")) {
|
||||
const adapterConfig = asRecord(patchData.adapterConfig);
|
||||
if (!adapterConfig) {
|
||||
|
|
@ -1729,8 +1731,17 @@ export function agentRoutes(db: Db) {
|
|||
const requestedAdapterConfig = Object.prototype.hasOwnProperty.call(patchData, "adapterConfig")
|
||||
? (asRecord(patchData.adapterConfig) ?? {})
|
||||
: null;
|
||||
if (
|
||||
requestedAdapterConfig
|
||||
&& replaceAdapterConfig
|
||||
&& KNOWN_INSTRUCTIONS_BUNDLE_KEYS.some((key) =>
|
||||
existingAdapterConfig[key] !== undefined && requestedAdapterConfig[key] === undefined,
|
||||
)
|
||||
) {
|
||||
await assertCanManageInstructionsPath(req, existing);
|
||||
}
|
||||
let rawEffectiveAdapterConfig = requestedAdapterConfig ?? existingAdapterConfig;
|
||||
if (requestedAdapterConfig && !changingAdapterType) {
|
||||
if (requestedAdapterConfig && !changingAdapterType && !replaceAdapterConfig) {
|
||||
rawEffectiveAdapterConfig = { ...existingAdapterConfig, ...requestedAdapterConfig };
|
||||
}
|
||||
if (changingAdapterType) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue