mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-15 00:44:56 -05:00
backfill improvements
This commit is contained in:
@@ -184,7 +184,7 @@ export async function GET(request: NextRequest) {
|
||||
}
|
||||
|
||||
if (lookupCredentialId) {
|
||||
const [row] = await db
|
||||
let [row] = await db
|
||||
.select({
|
||||
id: credential.id,
|
||||
displayName: credential.displayName,
|
||||
@@ -195,6 +195,24 @@ export async function GET(request: NextRequest) {
|
||||
.where(and(eq(credential.id, lookupCredentialId), eq(credential.workspaceId, workspaceId)))
|
||||
.limit(1)
|
||||
|
||||
if (!row) {
|
||||
;[row] = await db
|
||||
.select({
|
||||
id: credential.id,
|
||||
displayName: credential.displayName,
|
||||
type: credential.type,
|
||||
providerId: credential.providerId,
|
||||
})
|
||||
.from(credential)
|
||||
.where(
|
||||
and(
|
||||
eq(credential.accountId, lookupCredentialId),
|
||||
eq(credential.workspaceId, workspaceId)
|
||||
)
|
||||
)
|
||||
.limit(1)
|
||||
}
|
||||
|
||||
return NextResponse.json({ credential: row ?? null })
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,9 @@ export function CredentialSelector({
|
||||
if (!response.ok || cancelled) return
|
||||
const data = await response.json()
|
||||
if (!cancelled && data.credential?.displayName) {
|
||||
if (data.credential.id !== selectedId) {
|
||||
setStoreValue(data.credential.id)
|
||||
}
|
||||
setInaccessibleCredentialName(data.credential.displayName)
|
||||
}
|
||||
} catch {
|
||||
|
||||
@@ -109,6 +109,9 @@ export function ToolCredentialSelector({
|
||||
if (!response.ok || cancelled) return
|
||||
const data = await response.json()
|
||||
if (!cancelled && data.credential?.displayName) {
|
||||
if (data.credential.id !== selectedId) {
|
||||
onChange(data.credential.id)
|
||||
}
|
||||
setInaccessibleCredentialName(data.credential.displayName)
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user