mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 08:52:43 +00:00
refactor(auth): share profile id dedupe helper
This commit is contained in:
@@ -2,7 +2,7 @@ import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { AuthProfileConfig } from "../../config/types.js";
|
||||
import type { AuthProfileIdRepairResult, AuthProfileStore } from "./types.js";
|
||||
import { normalizeProviderId } from "../model-selection.js";
|
||||
import { listProfilesForProvider } from "./profiles.js";
|
||||
import { dedupeProfileIds, listProfilesForProvider } from "./profiles.js";
|
||||
|
||||
function getProfileSuffix(profileId: string): string {
|
||||
const idx = profileId.indexOf(":");
|
||||
@@ -139,12 +139,7 @@ export function repairOAuthProfileIdMismatch(params: {
|
||||
const replaced = existing
|
||||
.map((id) => (id === legacyProfileId ? toProfileId : id))
|
||||
.filter((id): id is string => typeof id === "string" && id.trim().length > 0);
|
||||
const deduped: string[] = [];
|
||||
for (const entry of replaced) {
|
||||
if (!deduped.includes(entry)) {
|
||||
deduped.push(entry);
|
||||
}
|
||||
}
|
||||
const deduped = dedupeProfileIds(replaced);
|
||||
return { ...order, [resolvedKey]: deduped };
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user