chore: ui cleanup to remove unused components and functions (#10761)
This commit is contained in:
@@ -82,7 +82,3 @@ export async function removeFromAgent(
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export function sanitizeName(name: string) {
|
||||
return name.toLowerCase().replace(/-/g, '').replace(/_/g, '').replace(/\s/g, '');
|
||||
}
|
||||
|
||||
@@ -15,25 +15,6 @@ export default interface Model {
|
||||
request_params?: Record<string, unknown> & { thinking_effort?: ThinkingEffort }; // provider-specific request parameters
|
||||
}
|
||||
|
||||
export function createModelStruct(
|
||||
modelName: string,
|
||||
provider: string,
|
||||
id?: number, // Make `id` optional to allow user-defined models
|
||||
lastUsed?: string,
|
||||
alias?: string, // optional model display name
|
||||
subtext?: string
|
||||
): Model {
|
||||
// use the metadata to create a Model
|
||||
return {
|
||||
name: modelName,
|
||||
provider: provider,
|
||||
alias: alias,
|
||||
id: id,
|
||||
lastUsed: lastUsed,
|
||||
subtext: subtext,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getProviderMetadata(providerName: string) {
|
||||
const providers = await acpListProviderDetails();
|
||||
const matches = providers.find((providerMatch) => providerMatch.name === providerName);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export default interface ParameterSchema {
|
||||
name: string;
|
||||
is_secret: boolean;
|
||||
required?: boolean;
|
||||
default?: string; // optional default values
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import React from 'react';
|
||||
import ParameterSchema from '../interfaces/ParameterSchema';
|
||||
import ProviderSetupFormProps from '../modal/interfaces/ProviderSetupFormProps';
|
||||
|
||||
export default interface ProviderDetails {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
parameters: ParameterSchema[];
|
||||
getTags?: (name: string) => string[];
|
||||
customForm?: React.ComponentType<ProviderSetupFormProps>;
|
||||
customSubmit?: (e: React.SyntheticEvent) => void;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
interface ProviderMetadata {
|
||||
[key: string]: string | number | boolean | null;
|
||||
}
|
||||
|
||||
// runtime data per instance
|
||||
export default interface ProviderState {
|
||||
id: string;
|
||||
name: string;
|
||||
isConfigured: boolean;
|
||||
metadata: ProviderMetadata;
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
import React from 'react';
|
||||
import ProviderState from '../../interfaces/ProviderState';
|
||||
|
||||
export default interface ProviderSetupFormProps {
|
||||
configValues: { [key: string]: string };
|
||||
setConfigValues: React.Dispatch<React.SetStateAction<{ [key: string]: string }>>;
|
||||
onSubmit: (e: React.FormEvent) => void;
|
||||
provider: ProviderState;
|
||||
}
|
||||
@@ -1,44 +1,13 @@
|
||||
import { defineMessages, useIntl } from '../../../../../i18n';
|
||||
import { defineMessages } from '../../../../../i18n';
|
||||
import type { IntlShape } from 'react-intl';
|
||||
|
||||
const i18n = defineMessages({
|
||||
ollamaNotConfiguredPrefix: {
|
||||
id: 'stringUtils.ollamaNotConfiguredPrefix',
|
||||
defaultMessage: 'To use, either the',
|
||||
},
|
||||
ollamaApp: {
|
||||
id: 'stringUtils.ollamaApp',
|
||||
defaultMessage: 'Ollama app',
|
||||
},
|
||||
ollamaNotConfiguredSuffix: {
|
||||
id: 'stringUtils.ollamaNotConfiguredSuffix',
|
||||
defaultMessage: 'must be installed on your machine and open, or you must enter a value for OLLAMA_HOST.',
|
||||
},
|
||||
configuredProvider: {
|
||||
id: 'stringUtils.configuredProvider',
|
||||
defaultMessage: '{name} provider is configured',
|
||||
},
|
||||
});
|
||||
|
||||
// Functions for string / string-based element creation (e.g. tooltips for each provider, descriptions, etc)
|
||||
export function OllamaNotConfiguredTooltipMessage() {
|
||||
const intl = useIntl();
|
||||
return (
|
||||
<p>
|
||||
{intl.formatMessage(i18n.ollamaNotConfiguredPrefix)}{' '}
|
||||
<a
|
||||
href="https://ollama.com/download"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-600 underline hover:text-blue-800"
|
||||
>
|
||||
{intl.formatMessage(i18n.ollamaApp)}
|
||||
</a>{' '}
|
||||
{intl.formatMessage(i18n.ollamaNotConfiguredSuffix)}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
export function ConfiguredProviderTooltipMessage(intl: IntlShape, name: string) {
|
||||
return intl.formatMessage(i18n.configuredProvider, { name });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user