-
Troubleshooting Details
-
- {typeof error === 'string' ? error : JSON.stringify(error, null, 2)}
+
+
+ Troubleshooting Details
+
+
+ {typeof error === "string" ? error : JSON.stringify(error, null, 2)}
)}
-
+
-
API Request
-
+
+ API Request
+
+
{curlCommand || "No request data available"}
- }
+ }
onClick={() => {
- navigator.clipboard.writeText(curlCommand || '');
- NotificationsManager.success('Copied to clipboard');
+ navigator.clipboard.writeText(curlCommand || "");
+ NotificationsManager.success("Copied to clipboard");
}}
>
Copy to Clipboard
@@ -240,14 +279,9 @@ ${formattedBody}
>
)}
-
-
-
}
- >
+
+
+ }>
View Documentation
@@ -255,4 +289,4 @@ ${formattedBody}
);
};
-export default ModelConnectionTest;
\ No newline at end of file
+export default ModelConnectionTest;
diff --git a/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsx b/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsx
index 6741e43af50..94d6bad0ce0 100644
--- a/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsx
@@ -7,7 +7,6 @@ import { provider_map, Providers } from "../provider_info_helpers";
import { CredentialItem } from "../networking";
const { Link } = Typography;
-
interface ProviderSpecificFieldsProps {
selectedProvider: Providers;
uploadProps?: UploadProps;
@@ -29,13 +28,10 @@ export interface CredentialValues {
value: string;
}
-
export const createCredentialFromModel = (provider: string, modelData: any): CredentialItem => {
console.log("provider", provider);
console.log("modelData", modelData);
- const enumKey = Object.keys(provider_map).find(
- key => provider_map[key].toLowerCase() === provider.toLowerCase()
- );
+ const enumKey = Object.keys(provider_map).find((key) => provider_map[key].toLowerCase() === provider.toLowerCase());
if (!enumKey) {
throw new Error(`Provider ${provider} not found in provider_map`);
}
@@ -46,7 +42,7 @@ export const createCredentialFromModel = (provider: string, modelData: any): Cre
console.log("providerFields", providerFields);
// Go through each field defined for this provider
- providerFields.forEach(field => {
+ providerFields.forEach((field) => {
const value = modelData.litellm_params[field.key];
console.log("field", field);
console.log("value", value);
@@ -61,8 +57,8 @@ export const createCredentialFromModel = (provider: string, modelData: any): Cre
credential_info: {
custom_llm_provider: provider,
description: `Credential for ${provider}. Created from model ${modelData.model_name}`,
- }
- }
+ },
+ };
return credential;
};
@@ -73,66 +69,60 @@ const PROVIDER_CREDENTIAL_FIELDS: Record
=
key: "api_base",
label: "API Base",
type: "select",
- options: [
- "https://api.openai.com/v1",
- "https://eu.api.openai.com"
- ],
- defaultValue: "https://api.openai.com/v1"
+ options: ["https://api.openai.com/v1", "https://eu.api.openai.com"],
+ defaultValue: "https://api.openai.com/v1",
},
{
key: "organization",
label: "OpenAI Organization ID",
- placeholder: "[OPTIONAL] my-unique-org"
+ placeholder: "[OPTIONAL] my-unique-org",
},
{
key: "api_key",
label: "OpenAI API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
],
[Providers.OpenAI_Text]: [
{
key: "api_base",
label: "API Base",
type: "select",
- options: [
- "https://api.openai.com/v1",
- "https://eu.api.openai.com"
- ],
- defaultValue: "https://api.openai.com/v1"
+ options: ["https://api.openai.com/v1", "https://eu.api.openai.com"],
+ defaultValue: "https://api.openai.com/v1",
},
{
key: "organization",
label: "OpenAI Organization ID",
- placeholder: "[OPTIONAL] my-unique-org"
+ placeholder: "[OPTIONAL] my-unique-org",
},
{
key: "api_key",
label: "OpenAI API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
],
[Providers.Vertex_AI]: [
{
key: "vertex_project",
label: "Vertex Project",
placeholder: "adroit-cadet-1234..",
- required: true
+ required: true,
},
{
key: "vertex_location",
label: "Vertex Location",
placeholder: "us-east-1",
- required: true
+ required: true,
},
{
key: "vertex_credentials",
label: "Vertex Credentials",
required: true,
- type: "upload"
- }
+ type: "upload",
+ },
],
[Providers.AssemblyAI]: [
{
@@ -140,78 +130,77 @@ const PROVIDER_CREDENTIAL_FIELDS: Record =
label: "API Base",
type: "select",
required: true,
- options: [
- "https://api.assemblyai.com",
- "https://api.eu.assemblyai.com"
- ]
+ options: ["https://api.assemblyai.com", "https://api.eu.assemblyai.com"],
},
{
key: "api_key",
label: "AssemblyAI API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
],
[Providers.Azure]: [
{
key: "api_base",
label: "API Base",
placeholder: "https://...",
- required: true
+ required: true,
},
{
key: "api_version",
label: "API Version",
placeholder: "2023-07-01-preview",
- tooltip: "By default litellm will use the latest version. If you want to use a different version, you can specify it here"
+ tooltip:
+ "By default litellm will use the latest version. If you want to use a different version, you can specify it here",
},
{
key: "base_model",
label: "Base Model",
- placeholder: "azure/gpt-3.5-turbo"
+ placeholder: "azure/gpt-3.5-turbo",
},
{
key: "api_key",
label: "Azure API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
],
[Providers.Azure_AI_Studio]: [
{
key: "api_base",
label: "API Base",
placeholder: "https://.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",
- tooltip: "Enter your full Target URI from Azure Foundry here. Example: https://litellm8397336933.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",
- required: true
+ tooltip:
+ "Enter your full Target URI from Azure Foundry here. Example: https://litellm8397336933.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",
+ required: true,
},
{
key: "api_key",
label: "Azure API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
],
[Providers.OpenAI_Compatible]: [
{
key: "api_base",
label: "API Base",
placeholder: "https://...",
- required: true
+ required: true,
},
{
key: "api_key",
label: "OpenAI API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
],
[Providers.Dashscope]: [
{
key: "api_key",
label: "Dashscope API Key",
type: "password",
- required: true
+ required: true,
},
{
key: "api_base",
@@ -219,22 +208,23 @@ const PROVIDER_CREDENTIAL_FIELDS: Record =
placeholder: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
defaultValue: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
required: true,
- tooltip: "The base URL for your Dashscope server. Defaults to https://dashscope-intl.aliyuncs.com/compatible-mode/v1 if not specified."
- }
+ tooltip:
+ "The base URL for your Dashscope server. Defaults to https://dashscope-intl.aliyuncs.com/compatible-mode/v1 if not specified.",
+ },
],
[Providers.OpenAI_Text_Compatible]: [
{
key: "api_base",
label: "API Base",
placeholder: "https://...",
- required: true
+ required: true,
},
{
key: "api_key",
label: "OpenAI API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
],
[Providers.Bedrock]: [
{
@@ -242,64 +232,70 @@ const PROVIDER_CREDENTIAL_FIELDS: Record =
label: "AWS Access Key ID",
type: "password",
required: false,
- tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."
+ tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",
},
{
key: "aws_secret_access_key",
label: "AWS Secret Access Key",
type: "password",
required: false,
- tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."
+ tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",
},
{
key: "aws_session_token",
label: "AWS Session Token",
type: "password",
required: false,
- tooltip: "Temporary credentials session token. You can provide the raw token or the environment variable (e.g. `os.environ/MY_SESSION_TOKEN`)."
+ tooltip:
+ "Temporary credentials session token. You can provide the raw token or the environment variable (e.g. `os.environ/MY_SESSION_TOKEN`).",
},
{
key: "aws_region_name",
label: "AWS Region Name",
placeholder: "us-east-1",
required: false,
- tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."
+ tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",
},
{
key: "aws_session_name",
label: "AWS Session Name",
placeholder: "my-session",
required: false,
- tooltip: "Name for the AWS session. You can provide the raw value or the environment variable (e.g. `os.environ/MY_SESSION_NAME`)."
+ tooltip:
+ "Name for the AWS session. You can provide the raw value or the environment variable (e.g. `os.environ/MY_SESSION_NAME`).",
},
{
key: "aws_profile_name",
label: "AWS Profile Name",
placeholder: "default",
required: false,
- tooltip: "AWS profile name to use for authentication. You can provide the raw value or the environment variable (e.g. `os.environ/MY_PROFILE_NAME`)."
+ tooltip:
+ "AWS profile name to use for authentication. You can provide the raw value or the environment variable (e.g. `os.environ/MY_PROFILE_NAME`).",
},
{
key: "aws_role_name",
label: "AWS Role Name",
placeholder: "MyRole",
required: false,
- tooltip: "AWS IAM role name to assume. You can provide the raw value or the environment variable (e.g. `os.environ/MY_ROLE_NAME`)."
+ tooltip:
+ "AWS IAM role name to assume. You can provide the raw value or the environment variable (e.g. `os.environ/MY_ROLE_NAME`).",
},
{
key: "aws_web_identity_token",
label: "AWS Web Identity Token",
type: "password",
required: false,
- tooltip: "Web identity token for OIDC authentication. You can provide the raw token or the environment variable (e.g. `os.environ/MY_WEB_IDENTITY_TOKEN`)."
+ tooltip:
+ "Web identity token for OIDC authentication. You can provide the raw token or the environment variable (e.g. `os.environ/MY_WEB_IDENTITY_TOKEN`).",
},
{
key: "aws_bedrock_runtime_endpoint",
label: "AWS Bedrock Runtime Endpoint",
placeholder: "https://bedrock-runtime.us-east-1.amazonaws.com",
required: false,
- tooltip: "Custom Bedrock runtime endpoint URL. You can provide the raw value or the environment variable (e.g. `os.environ/MY_BEDROCK_ENDPOINT`)."
- }
+ tooltip:
+ "Custom Bedrock runtime endpoint URL. You can provide the raw value or the environment variable (e.g. `os.environ/MY_BEDROCK_ENDPOINT`).",
+ },
],
[Providers.SageMaker]: [
{
@@ -307,22 +303,22 @@ const PROVIDER_CREDENTIAL_FIELDS: Record =
label: "AWS Access Key ID",
type: "password",
required: false,
- tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."
+ tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",
},
{
key: "aws_secret_access_key",
label: "AWS Secret Access Key",
type: "password",
required: false,
- tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."
+ tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",
},
{
key: "aws_region_name",
label: "AWS Region Name",
placeholder: "us-east-1",
required: false,
- tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."
- }
+ tooltip: "You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",
+ },
],
[Providers.Ollama]: [
{
@@ -331,202 +327,248 @@ const PROVIDER_CREDENTIAL_FIELDS: Record =
placeholder: "http://localhost:11434",
defaultValue: "http://localhost:11434",
required: false,
- tooltip: "The base URL for your Ollama server. Defaults to http://localhost:11434 if not specified."
- }
+ tooltip: "The base URL for your Ollama server. Defaults to http://localhost:11434 if not specified.",
+ },
+ ],
+ [Providers.Anthropic]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ placeholder: "sk-",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Deepgram]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.ElevenLabs]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Google_AI_Studio]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ placeholder: "aig-",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Groq]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.MistralAI]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Deepseek]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Cohere]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Databricks]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.xAI]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.AIML]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Cerebras]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Sambanova]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Perplexity]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.TogetherAI]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Openrouter]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.FireworksAI]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
],
- [Providers.Anthropic]: [{
- key: "api_key",
- label: "API Key",
- placeholder: "sk-",
- type: "password",
- required: true
- }],
- [Providers.Deepgram]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.ElevenLabs]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Google_AI_Studio]: [{
- key: "api_key",
- label: "API Key",
- placeholder: "aig-",
- type: "password",
- required: true
- }],
- [Providers.Groq]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.MistralAI]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Deepseek]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Cohere]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Databricks]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.xAI]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.AIML]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Cerebras]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Sambanova]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Perplexity]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.TogetherAI]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Openrouter]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.FireworksAI]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
[Providers.GradientAI]: [
{
key: "api_base",
label: "GradientAI Endpoint",
placeholder: "https://...",
- required: false
+ required: false,
},
{
key: "api_key",
label: "GradientAI API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
+ ],
+ [Providers.Triton]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: false,
+ },
+ {
+ key: "api_base",
+ label: "API Base",
+ placeholder: "http://localhost:8000/generate",
+ required: false,
+ },
],
- [Providers.Triton]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: false
- },
- {
- key: "api_base",
- label: "API Base",
- placeholder: "http://localhost:8000/generate",
- required: false
- }],
[Providers.Hosted_Vllm]: [
{
key: "api_base",
label: "API Base",
placeholder: "https://...",
- required: true
+ required: true,
},
{
key: "api_key",
label: "OpenAI API Key",
type: "password",
- required: true
- }
+ required: true,
+ },
+ ],
+ [Providers.Voyage]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.JinaAI]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.VolcEngine]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.DeepInfra]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Oracle]: [
+ {
+ key: "api_key",
+ label: "API Key",
+ type: "password",
+ required: true,
+ },
+ ],
+ [Providers.Snowflake]: [
+ {
+ key: "api_key",
+ label: "Snowflake API Key / JWT Key for Authentication",
+ type: "password",
+ required: true,
+ },
+ {
+ key: "api_base",
+ label: "Snowflake API Endpoint",
+ placeholder: "https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",
+ tooltip:
+ "Enter the full endpoint with path here. Example: https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",
+ required: true,
+ },
],
- [Providers.Voyage]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.JinaAI]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.VolcEngine]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.DeepInfra]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Oracle]: [{
- key: "api_key",
- label: "API Key",
- type: "password",
- required: true
- }],
- [Providers.Snowflake]: [{
- key: "api_key",
- label: "Snowflake API Key / JWT Key for Authentication",
- type: "password",
- required: true
- },
- {
- key: "api_base",
- label: "Snowflake API Endpoint",
- placeholder: "https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",
- tooltip: "Enter the full endpoint with path here. Example: https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",
- required: true
- }]
};
-const ProviderSpecificFields: React.FC = ({
- selectedProvider,
- uploadProps
-}) => {
+const ProviderSpecificFields: React.FC = ({ selectedProvider, uploadProps }) => {
const selectedProviderEnum = Providers[selectedProvider as keyof typeof Providers] as Providers;
const form = Form.useFormInstance(); // Get form instance from context
@@ -561,7 +603,7 @@ const ProviderSpecificFields: React.FC = ({
if (info.file.status !== "uploading") {
console.log(info.file, info.fileList);
}
- }
+ },
};
return (
@@ -576,10 +618,7 @@ const ProviderSpecificFields: React.FC = ({
className={field.key === "vertex_credentials" ? "mb-0" : undefined}
>
{field.type === "select" ? (
-
+
{field.options?.map((option) => (
{option}
@@ -605,10 +644,7 @@ const ProviderSpecificFields: React.FC = ({
}>Click to Upload
) : (
-
+
)}
@@ -616,9 +652,7 @@ const ProviderSpecificFields: React.FC = ({
{field.key === "vertex_credentials" && (
-
- Give a gcp service account(.json file)
-
+ Give a gcp service account(.json file)
)}
@@ -629,8 +663,7 @@ const ProviderSpecificFields: React.FC = ({
- The actual model your azure deployment uses. Used
- for accurate cost tracking. Select name from{" "}
+ The actual model your azure deployment uses. Used for accurate cost tracking. Select name from{" "}
void;
}
-const RouterConfigBuilder: React.FC = ({
- modelInfo,
- value,
- onChange,
-}) => {
+const RouterConfigBuilder: React.FC = ({ modelInfo, value, onChange }) => {
const [routes, setRoutes] = useState([]);
const [showJsonPreview, setShowJsonPreview] = useState(false);
const [expandedRoutes, setExpandedRoutes] = useState([]);
@@ -54,9 +50,9 @@ const RouterConfigBuilder: React.FC = ({
score_threshold: route.score_threshold || 0.5,
}));
setRoutes(initializedRoutes);
-
+
// Set expanded routes for existing routes
- const routeIds = initializedRoutes.map(route => route.id);
+ const routeIds = initializedRoutes.map((route) => route.id);
setExpandedRoutes(routeIds);
} else {
setRoutes([]);
@@ -78,23 +74,21 @@ const RouterConfigBuilder: React.FC = ({
setRoutes(updatedRoutes);
updateConfig(updatedRoutes);
// Automatically expand the new route
- setExpandedRoutes(prev => [...prev, newRouteId]);
+ setExpandedRoutes((prev) => [...prev, newRouteId]);
};
// Handle removing a route
const removeRoute = (routeId: string) => {
- const updatedRoutes = routes.filter(route => route.id !== routeId);
+ const updatedRoutes = routes.filter((route) => route.id !== routeId);
setRoutes(updatedRoutes);
updateConfig(updatedRoutes);
// Remove from expanded routes as well
- setExpandedRoutes(prev => prev.filter(id => id !== routeId));
+ setExpandedRoutes((prev) => prev.filter((id) => id !== routeId));
};
// Handle updating a route
const updateRoute = (routeId: string, field: keyof Route, value: any) => {
- const updatedRoutes = routes.map(route =>
- route.id === routeId ? { ...route, [field]: value } : route
- );
+ const updatedRoutes = routes.map((route) => (route.id === routeId ? { ...route, [field]: value } : route));
setRoutes(updatedRoutes);
updateConfig(updatedRoutes);
};
@@ -102,7 +96,7 @@ const RouterConfigBuilder: React.FC = ({
// Update the overall configuration
const updateConfig = (updatedRoutes: Route[]) => {
const config = {
- routes: updatedRoutes.map(route => ({
+ routes: updatedRoutes.map((route) => ({
name: route.model,
utterances: route.utterances,
description: route.description,
@@ -115,21 +109,21 @@ const RouterConfigBuilder: React.FC = ({
// Handle utterances change (convert textarea string to array)
const handleUtterancesChange = (routeId: string, utterancesText: string) => {
const utterancesArray = utterancesText
- .split('\n')
- .map(line => line.trim()) // Only trims leading/trailing whitespace, preserves internal spaces
- .filter(line => line.length > 0);
- updateRoute(routeId, 'utterances', utterancesArray);
+ .split("\n")
+ .map((line) => line.trim()) // Only trims leading/trailing whitespace, preserves internal spaces
+ .filter((line) => line.length > 0);
+ updateRoute(routeId, "utterances", utterancesArray);
};
// Prepare model options for dropdowns
- const modelOptions = modelInfo.map(model => ({
+ const modelOptions = modelInfo.map((model) => ({
value: model.model_group,
label: model.model_group,
}));
const generateConfig = () => {
return {
- routes: routes.map(route => ({
+ routes: routes.map((route) => ({
name: route.model,
utterances: route.utterances,
description: route.description,
@@ -148,12 +142,7 @@ const RouterConfigBuilder: React.FC = ({
- }
- onClick={addRoute}
- className="bg-blue-600 hover:bg-blue-700"
- >
+ } onClick={addRoute} className="bg-blue-600 hover:bg-blue-700">
Add Route