mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-10 02:02:31 +08:00
fix: resolve lint errors for CI
This commit is contained in:
@@ -134,6 +134,7 @@ export const ModelSelectorLogo = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
// biome-ignore lint/performance/noImgElement: External URL from models.dev
|
||||||
<img
|
<img
|
||||||
{...props}
|
{...props}
|
||||||
alt={`${provider} logo`}
|
alt={`${provider} logo`}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import {
|
|||||||
replaceNodes,
|
replaceNodes,
|
||||||
validateAndFixXml,
|
validateAndFixXml,
|
||||||
} from "@/lib/utils"
|
} from "@/lib/utils"
|
||||||
import ExamplePanel from "./chat-example-panel"
|
|
||||||
|
|
||||||
// Helper to extract complete operations from streaming input
|
// Helper to extract complete operations from streaming input
|
||||||
function getCompleteOperations(
|
function getCompleteOperations(
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ function ProviderLogo({
|
|||||||
|
|
||||||
const logoName = PROVIDER_LOGO_MAP[provider] || provider
|
const logoName = PROVIDER_LOGO_MAP[provider] || provider
|
||||||
return (
|
return (
|
||||||
|
// biome-ignore lint/performance/noImgElement: External URL from models.dev
|
||||||
<img
|
<img
|
||||||
alt={`${provider} logo`}
|
alt={`${provider} logo`}
|
||||||
className={cn("size-4 dark:invert", className)}
|
className={cn("size-4 dark:invert", className)}
|
||||||
@@ -273,7 +274,7 @@ export function ModelConfigDialog({
|
|||||||
|
|
||||||
// Validate all models
|
// Validate all models
|
||||||
const handleValidate = useCallback(async () => {
|
const handleValidate = useCallback(async () => {
|
||||||
if (!selectedProvider) return
|
if (!selectedProvider || !selectedProviderId) return
|
||||||
|
|
||||||
// Check credentials based on provider type
|
// Check credentials based on provider type
|
||||||
const isBedrock = selectedProvider.provider === "bedrock"
|
const isBedrock = selectedProvider.provider === "bedrock"
|
||||||
@@ -331,14 +332,14 @@ export function ModelConfigDialog({
|
|||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
|
|
||||||
if (data.valid) {
|
if (data.valid) {
|
||||||
updateModel(selectedProviderId!, model.id, {
|
updateModel(selectedProviderId, model.id, {
|
||||||
validated: true,
|
validated: true,
|
||||||
validationError: undefined,
|
validationError: undefined,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
allValid = false
|
allValid = false
|
||||||
errorCount++
|
errorCount++
|
||||||
updateModel(selectedProviderId!, model.id, {
|
updateModel(selectedProviderId, model.id, {
|
||||||
validated: false,
|
validated: false,
|
||||||
validationError: data.error || "Validation failed",
|
validationError: data.error || "Validation failed",
|
||||||
})
|
})
|
||||||
@@ -346,7 +347,7 @@ export function ModelConfigDialog({
|
|||||||
} catch {
|
} catch {
|
||||||
allValid = false
|
allValid = false
|
||||||
errorCount++
|
errorCount++
|
||||||
updateModel(selectedProviderId!, model.id, {
|
updateModel(selectedProviderId, model.id, {
|
||||||
validated: false,
|
validated: false,
|
||||||
validationError: "Network error",
|
validationError: "Network error",
|
||||||
})
|
})
|
||||||
@@ -357,7 +358,7 @@ export function ModelConfigDialog({
|
|||||||
|
|
||||||
if (allValid) {
|
if (allValid) {
|
||||||
setValidationStatus("success")
|
setValidationStatus("success")
|
||||||
updateProvider(selectedProviderId!, { validated: true })
|
updateProvider(selectedProviderId, { validated: true })
|
||||||
// Reset to idle after showing success briefly (with cleanup)
|
// Reset to idle after showing success briefly (with cleanup)
|
||||||
if (validationResetTimeoutRef.current) {
|
if (validationResetTimeoutRef.current) {
|
||||||
clearTimeout(validationResetTimeoutRef.current)
|
clearTimeout(validationResetTimeoutRef.current)
|
||||||
@@ -1298,20 +1299,24 @@ export function ModelConfigDialog({
|
|||||||
null,
|
null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
updateModel(
|
if (
|
||||||
selectedProviderId!,
|
selectedProviderId
|
||||||
model.id,
|
) {
|
||||||
{
|
updateModel(
|
||||||
modelId:
|
selectedProviderId,
|
||||||
e
|
model.id,
|
||||||
.target
|
{
|
||||||
.value,
|
modelId:
|
||||||
validated:
|
e
|
||||||
undefined,
|
.target
|
||||||
validationError:
|
.value,
|
||||||
undefined,
|
validated:
|
||||||
},
|
undefined,
|
||||||
)
|
validationError:
|
||||||
|
undefined,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onKeyDown={(
|
onKeyDown={(
|
||||||
e,
|
e,
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function handleOptionsRequest(): Response {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function onRequest({ request, env }: any) {
|
export async function onRequest({ request, env: _env }: any) {
|
||||||
if (request.method === "OPTIONS") {
|
if (request.method === "OPTIONS") {
|
||||||
return handleOptionsRequest()
|
return handleOptionsRequest()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -573,8 +573,8 @@ export function getAIModel(overrides?: ClientOverrides): ModelConfig {
|
|||||||
const bedrockProvider = hasClientCredentials
|
const bedrockProvider = hasClientCredentials
|
||||||
? createAmazonBedrock({
|
? createAmazonBedrock({
|
||||||
region: bedrockRegion,
|
region: bedrockRegion,
|
||||||
accessKeyId: overrides.awsAccessKeyId!,
|
accessKeyId: overrides.awsAccessKeyId as string,
|
||||||
secretAccessKey: overrides.awsSecretAccessKey!,
|
secretAccessKey: overrides.awsSecretAccessKey as string,
|
||||||
...(overrides?.awsSessionToken && {
|
...(overrides?.awsSessionToken && {
|
||||||
sessionToken: overrides.awsSessionToken,
|
sessionToken: overrides.awsSessionToken,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user