Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions public/image/CircleAdd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"submit": "Save Settings",
"provider": "Model Provider",
"verify": "Verify Model",
"verifying": "Verifying...",
"verifySuccess": "Model verification successful",
"verifySuccessNoTool": "Model verification successful, but does not support Tool Calls",
"verifyFailed": "Model verification failed",
Expand Down Expand Up @@ -199,7 +200,25 @@
"modelSetting": "{{name}} Model Settings",
"streamingModeTooltip": "Streaming Mode is when the model responds, it shows the content gradually, instead of showing it all at once. Turning off the button, in the Non-Streaming Mode, will wait for the model to generate the content completely and display it all at once, avoiding compatibility issues with tool calls in the model.",
"streamingModeDescription": "Control how model responses are displayed",
"streamingModeAlert": "Reminder: {{name}} model does not support tool calls in Streaming mode. If you need to use tool functionality, please turn off this button and adjust to Non-Streaming Mode."
"streamingModeAlert": "Reminder: {{name}} model does not support tool calls in Streaming mode. If you need to use tool functionality, please turn off this button and adjust to Non-Streaming Mode.",
"customInput": "Custom Input",
"addCustomParameter": "Add Custom Parameter",
"parameterName": "Parameter Name",
"parameterType": "Parameter Type",
"parameterValue": "Parameter Value",
"parameterNameDescription": "Enter name, like temperature",
"parameterTypeDescription": "Select type",
"parameterValueDescription": "Please select the parameter type first and then enter the value",
"parameterNameDuplicate": "Parameter name already exists",
"parameterTypeInt": "Integer",
"parameterTypeFloat": "Float",
"parameterTypeString": "String",
"parameterTypeIntDescription": "Allowed range 0-1M",
"parameterTypeFloatDescription": "Allowed range 0.0-1.0",
"parameterTypeStringDescription": "Please enter a string, like medium",
"reasoningLevelDescription": "Set the depth of model thinking",
"reasoningLevelTooltip": "Low represents a quick response, focusing on conclusions and without additional details, with a direct and simple reasoning. Medium provides a response with sufficient logical explanation, covering key information. High offers a deep response with a structured and detailed analysis and explanation.",
"tokenBudgetDescription": "Set reasoning value ({{min}}~{{max}})"
},
"system": {
"title": "System Settings",
Expand Down
21 changes: 20 additions & 1 deletion public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"submit": "Guardar Configuración",
"provider": "Proveedor del Modelo",
"verify": "Verificar Modelo",
"verifying": "Verificando modelo...",
"verifySuccess": "Verificación del modelo exitosa",
"verifySuccessNoTool": "Verificación exitosa, pero el modelo no admite llamadas de herramientas",
"verifyFailed": "Verificación del modelo fallida",
Expand Down Expand Up @@ -199,7 +200,25 @@
"modelSetting": "Configuración de {{name}}",
"streamingModeTooltip": "Streaming Mode es cuando el modelo responde, muestra el contenido gradualmente, en lugar de mostrarlo de una vez. Desactivar el botón, en el modo Non-Streaming Mode, esperará a que el modelo genere el contenido completo y lo muestre de una vez, evitando problemas de compatibilidad con las llamadas a herramientas.",
"streamingModeDescription": "Controla cómo se muestra la respuesta del modelo",
"streamingModeAlert": "Advertencia: {{name}} actualmente es un modelo en modo Streaming que no admite llamadas a herramientas. Si necesita usar la función de herramientas, desactive este botón y ajuste el modo a Non-Streaming Mode."
"streamingModeAlert": "Advertencia: {{name}} actualmente es un modelo en modo Streaming que no admite llamadas a herramientas. Si necesita usar la función de herramientas, desactive este botón y ajuste el modo a Non-Streaming Mode.",
"customInput": "Parámetro personalizado",
"addCustomParameter": "Agregar parámetro personalizado",
"parameterName": "Nombre del parámetro",
"parameterType": "Tipo de parámetro",
"parameterValue": "Valor del parámetro",
"parameterNameDescription": "Ingrese el nombre del parámetro, como temperature",
"parameterTypeDescription": "Seleccione el tipo",
"parameterValueDescription": "Por favor, seleccione el tipo de parámetro primero y luego ingrese el valor",
"parameterNameDuplicate": "El nombre del parámetro ya existe",
"parameterTypeInt": "Entero",
"parameterTypeFloat": "Flotante",
"parameterTypeString": "Cadena",
"parameterTypeIntDescription": "Rango permitido 0-1M",
"parameterTypeFloatDescription": "Rango permitido 0.0-1.0",
"parameterTypeStringDescription": "Ingrese una cadena, como medium",
"reasoningLevelDescription": "Establece la profundidad de la reflexión del modelo",
"reasoningLevelTooltip": "Low representa una respuesta rápida, enfocada en conclusiones y sin detalles adicionales, con un razonamiento directo y simple. Medium proporciona una respuesta con suficiente explicación lógica, cubriendo información clave. High ofrece una respuesta profunda con un razonamiento estructurado y detallado.",
"tokenBudgetDescription": "Establece el límite de tokens de razonamiento ({{min}}~{{max}})"
},
"system": {
"title": "Configuración del Sistema",
Expand Down
1 change: 1 addition & 0 deletions public/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"submit": "設定を保存",
"provider": "モデルプロバイダー",
"verify": "モデルを検証",
"verifying": "検証中...",
"verifySuccess": "モデルの検証に成功しました",
"verifySuccessNoTool": "モデルの検証に成功しましたが、ツール呼び出しはサポートしていません",
"verifyFailed": "モデルの検証に失敗しました",
Expand Down
21 changes: 20 additions & 1 deletion public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"submit": "保存设置",
"provider": "模型提供者",
"verify": "验证模型",
"verifying": "验证中...",
"verifySuccess": "模型验证成功",
"verifySuccessNoTool": "模型验证成功,但不支持Tool Calls",
"verifyFailed": "模型验证失败",
Expand Down Expand Up @@ -199,7 +200,25 @@
"modelSetting": "{{name}} 模型设置",
"streamingModeTooltip": "Streaming Mode 是指 AI 回应时,即时逐步输出内容,而不是一次性完整回应。关闭按钮,在 Non-Streaming Mode 下,则是等待模型完全生成完毕后,回应一次性显示,可以避免工具调用在模型中的兼容性问题。",
"streamingModeDescription": "控制模型回应的显示方式",
"streamingModeAlert": "提醒:{{name}}目前是Streaming mode模式不支持tool calls使用。如果您需要使用工具功能,请关闭此按钮,调整成Non-Streaming Mode模式。"
"streamingModeAlert": "提醒:{{name}}目前是Streaming mode模式不支持tool calls使用。如果您需要使用工具功能,请关闭此按钮,调整成Non-Streaming Mode模式。",
"customInput": "自定义参数",
"addCustomParameter": "添加自定义参数",
"parameterName": "参数名称",
"parameterType": "参数类型",
"parameterValue": "参数值",
"parameterNameDescription": "输入名称,如 temperature",
"parameterTypeDescription": "选择类型",
"parameterValueDescription": "请先选择参数类型,再填写数值",
"parameterNameDuplicate": "参数名称已存在",
"parameterTypeInt": "整数",
"parameterTypeFloat": "浮点数",
"parameterTypeString": "字符串",
"parameterTypeIntDescription": "允许的范圍0-1M",
"parameterTypeFloatDescription": "允许的范圍0.0-1.0",
"parameterTypeStringDescription": "请输入字符,例如:medium",
"reasoningLevelDescription": "设置模型思考的深度",
"reasoningLevelTooltip": "用来控制模型思考与推理的深度。Low代表快速回应,偏重结论、没有过多细节,推理简单直接;Medium代表回应适度说明逻辑、涵盖关键信息;High代表回应深度推理,条理清晰、有结构的分析与说明。",
"tokenBudgetDescription": "设置推理数值 ({{min}}~{{max}})"
},
"system": {
"title": "系统设置",
Expand Down
21 changes: 20 additions & 1 deletion public/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"submit": "儲存設定",
"provider": "模型提供者",
"verify": "驗證模型",
"verifying": "驗證中...",
"verifySuccess": "模型驗證成功",
"verifySuccessNoTool": "模型驗證成功,但不支援Tool Calls",
"verifyFailed": "模型驗證失敗",
Expand Down Expand Up @@ -199,7 +200,25 @@
"modelSetting": "{{name}} 模型設定",
"streamingModeTooltip": "Streaming Mode 是指 AI 回應時,即時逐步輸出內容,而不是一次性完整回應。關閉按鈕,在 Non-Streaming Mode 下,則是等待模型完全生成完畢後,回應一次性顯示,可以避免工具調用在模型中的兼容性問題。",
"streamingModeDescription": "控制模型回應的顯示方式",
"streamingModeAlert": "提醒:{{name}} 目前是 Streaming mode 模式不支援 tool calls 使用。 如果您需要使用工具功能,請關閉此按鈕,調整成 Non-Streaming Mode 模式。"
"streamingModeAlert": "提醒:{{name}} 目前是 Streaming mode 模式不支援 tool calls 使用。 如果您需要使用工具功能,請關閉此按鈕,調整成 Non-Streaming Mode 模式。",
"customInput": "自訂參數",
"addCustomParameter": "添加自訂參數",
"parameterName": "參數名稱",
"parameterType": "參數類型",
"parameterValue": "參數值",
"parameterNameDescription": "輸入名稱,如 temperature",
"parameterTypeDescription": "選擇類型",
"parameterValueDescription": "請先選擇參數類型,再填寫數值",
"parameterNameDuplicate": "參數名稱重複",
"parameterTypeInt": "整數",
"parameterTypeFloat": "浮點數",
"parameterTypeString": "字符串",
"parameterTypeIntDescription": "允許的範圍0-1M",
"parameterTypeFloatDescription": "允許的範圍0.0-1.0",
"parameterTypeStringDescription": "請輸入字符,例如:medium",
"reasoningLevelDescription": "設置模型思考的深度",
"reasoningLevelTooltip": "用來控制模型思考與推理的深度。Low代表快速回應,偏重結論、沒有過多細節,推理簡單直接;Medium代表回應適度說明邏輯、涵蓋關鍵資訊;High代表回應深度推理,條理清晰、有結構的分析與說明。",
"tokenBudgetDescription": "設置推理數值 ({{min}}~{{max}})"
},
"system": {
"title": "系統設定",
Expand Down
9 changes: 7 additions & 2 deletions src/atoms/configState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ export type ModelConfig = ProviderRequired & ModelParameter & {
}

export type InterfaceModelConfig = Omit<ModelConfig, "modelProvider"> & Partial<ModelParameter> & Partial<BedrockCredentials> & {
modelProvider: InterfaceProvider
}
modelProvider: InterfaceProvider;
checked?: boolean;
name?: string;
};

export type ModelConfigMap = Record<string, ModelConfig>
export type InterfaceModelConfigMap = Record<string, InterfaceModelConfig>
Expand All @@ -45,6 +47,9 @@ export type MultiModelConfig = ProviderRequired & ModelParameter & Partial<Bedro
active: boolean
checked: boolean
models: string[]
parameters: {
[key: string]: any
}
}

export const configAtom = atom<RawModelConfig>({
Expand Down
4 changes: 3 additions & 1 deletion src/components/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface Props<T = string>{
maxHeight?: number
autoWidth?: boolean
align?: "center" | "start" | "end"
leftSlotType?: 'col' | 'row'
}

/** DropdownMenu */
Expand All @@ -42,6 +43,7 @@ const Select = forwardRef<HTMLButtonElement|null, Props>(({
maxHeight,
autoWidth,
align = 'start',
leftSlotType = 'col',
...rest
}, ref) => {
const currentOption = options.find((option) => option.value === value) || null
Expand Down Expand Up @@ -77,7 +79,7 @@ const Select = forwardRef<HTMLButtonElement|null, Props>(({
onSelect(item.value)
}}
>
<div className="left-slot">
<div className={`left-slot ${leftSlotType}`}>
<div className="label">{item.label}</div>
{item.info &&
<div className="info">{item.info}</div>
Expand Down
57 changes: 46 additions & 11 deletions src/helper/config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
import { InterfaceModelConfig, InterfaceModelConfigMap, ModelConfig, ModelConfigMap, MultiModelConfig } from "../atoms/configState"
import { InterfaceProvider, ModelProvider } from "../atoms/interfaceState"

export const formatData = (data: InterfaceModelConfig|ModelConfig): MultiModelConfig => {
const { modelProvider, model, apiKey, baseURL, active, topP, temperature, ...extra } = convertConfigToInterfaceModel(data)
export const formatData = (data: InterfaceModelConfig | ModelConfig): MultiModelConfig => {
const {
modelProvider,
model,
apiKey,
baseURL,
active,
topP,
temperature,
configuration,
checked,
name,
...otherParams
} = convertConfigToInterfaceModel(data)

const baseParams = { topP: topP ?? 0, temperature: temperature ?? 0 }

const allParams = { ...baseParams, ...otherParams }

return {
...extra,
name: modelProvider,
apiKey,
baseURL,
active: active ?? false,
checked: false,
models: model ? [model] : [],
topP: topP ?? 0,
temperature: temperature ?? 0,
model,
temperature: temperature ?? 0,
topP: topP ?? 0,
parameters: model
? {
[model]: allParams,
}
: {},
}
}

Expand All @@ -28,31 +49,45 @@ export const extractData = (data: InterfaceModelConfigMap|ModelConfigMap) => {
const _index = parseInt(index)

if (!providerConfigList[_index]) {
const _value: InterfaceModelConfig|ModelConfig = {...value}
const _value: InterfaceModelConfig | ModelConfig = { ...value }
_value.modelProvider = name as InterfaceProvider
providerConfigList[_index] = {
...formatData(_value),
}
} else if(value.model) {
} else if (value.model) {
const formatData_ = formatData(value)
const allParams = formatData_.parameters[value.model] || {}
providerConfigList[_index].models.push(value.model)
providerConfigList[_index].parameters = {
...(providerConfigList[_index].parameters || {}),
[value.model]: {
...allParams,
},
}
}
})

return providerConfigList
}

export const compressData = (data: MultiModelConfig, index: number) => {
export const compressData = (
data: MultiModelConfig,
index: number,
_parameter: Record<string, any>,
) => {
const compressedData: Record<string, InterfaceModelConfig> = {}

const { models, ...restData } = data
const { models, parameters, ...restData } = data
const modelsToProcess = models.length === 0 ? [null] : models
modelsToProcess.forEach((model, modelIndex) => {
const formData = {
...restData,
model: model,
modelProvider: data.name
modelProvider: data.name,
...(model ? parameters[model] || {} : _parameter),
}
const configuration = {...formData} as Partial<Pick<InterfaceModelConfig, "configuration">> & Omit<InterfaceModelConfig, "configuration">
const configuration = { ...formData } as Partial<Pick<InterfaceModelConfig, 'configuration'>> &
Omit<InterfaceModelConfig, 'configuration'>
delete configuration.configuration
compressedData[`${restData.name}-${index}-${modelIndex}`] = {
...formData,
Expand Down
Loading