@solidxai/core-ui 0.1.7-beta.8 → 0.1.7-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/common/GeneralSettings.d.ts.map +1 -1
- package/dist/components/common/GeneralSettings.js +68 -36
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/GeneralSettings.tsx +81 -42
- package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.d.ts +27 -5
- package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.d.ts.map +1 -1
- package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.js +25 -37
- package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.js.map +1 -1
- package/dist/components/common/SolidSettings/LlmSettings/AiModelConfigTab.tsx +131 -52
- package/dist/components/core/chatter/SolidChatter.d.ts +2 -1
- package/dist/components/core/chatter/SolidChatter.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatter.js +2 -2
- package/dist/components/core/chatter/SolidChatter.js.map +1 -1
- package/dist/components/core/chatter/SolidChatter.tsx +2 -1
- package/dist/components/core/chatter/SolidChatterHeader.d.ts +1 -0
- package/dist/components/core/chatter/SolidChatterHeader.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.js +3 -3
- package/dist/components/core/chatter/SolidChatterHeader.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.tsx +4 -3
- package/dist/components/core/chatter/SolidMessageComposer.d.ts +2 -1
- package/dist/components/core/chatter/SolidMessageComposer.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidMessageComposer.js +3 -1
- package/dist/components/core/chatter/SolidMessageComposer.js.map +1 -1
- package/dist/components/core/chatter/SolidMessageComposer.tsx +3 -1
- package/dist/components/core/common/SolidViewLayoutManager.d.ts +17 -0
- package/dist/components/core/common/SolidViewLayoutManager.d.ts.map +1 -1
- package/dist/components/core/common/SolidViewLayoutManager.js +58 -1
- package/dist/components/core/common/SolidViewLayoutManager.js.map +1 -1
- package/dist/components/core/common/SolidViewLayoutManager.ts +43 -2
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.js +92 -0
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.js.map +1 -0
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.tsx +68 -0
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.js +87 -0
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.js.map +1 -0
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.tsx +70 -0
- package/dist/components/core/extension/solid-core/listOfValues/form/SolidLovTypeChangeFormEditWidget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/listOfValues/form/SolidLovTypeChangeFormEditWidget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/listOfValues/form/SolidLovTypeChangeFormEditWidget.js +111 -0
- package/dist/components/core/extension/solid-core/listOfValues/form/SolidLovTypeChangeFormEditWidget.js.map +1 -0
- package/dist/components/core/extension/solid-core/listOfValues/form/SolidLovTypeChangeFormEditWidget.tsx +122 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/SolidMqMessageStageFormViewWIdget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/SolidMqMessageStageFormViewWIdget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/SolidMqMessageStageFormViewWIdget.js +10 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/SolidMqMessageStageFormViewWIdget.js.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/SolidMqMessageStageFormViewWIdget.tsx +21 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/mqMessageOnFormLoadHandler.d.ts +8 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/mqMessageOnFormLoadHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/mqMessageOnFormLoadHandler.js +62 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/mqMessageOnFormLoadHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/form/mqMessageOnFormLoadHandler.tsx +27 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessageStageListViewWidget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessageStageListViewWidget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessageStageListViewWidget.js +8 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessageStageListViewWidget.js.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessageStageListViewWidget.tsx +15 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.d.ts +3 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.js +158 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.js.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.tsx +185 -0
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.d.ts +17 -0
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.js +52 -0
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.js.map +1 -0
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.tsx +83 -0
- package/dist/components/core/locales/SolidChatterLocaleTabView.d.ts.map +1 -1
- package/dist/components/core/locales/SolidChatterLocaleTabView.js +7 -5
- package/dist/components/core/locales/SolidChatterLocaleTabView.js.map +1 -1
- package/dist/components/core/locales/SolidChatterLocaleTabView.tsx +3 -0
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.css +38 -0
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.d.ts +1 -0
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.d.ts.map +1 -1
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.js +4 -3
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.js.map +1 -1
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.tsx +13 -3
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.d.ts +2 -1
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.d.ts.map +1 -1
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.js +6 -5
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.js.map +1 -1
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.tsx +6 -7
- package/dist/components/core/users/CreateUser.d.ts.map +1 -1
- package/dist/components/core/users/CreateUser.js +89 -35
- package/dist/components/core/users/CreateUser.js.map +1 -1
- package/dist/components/core/users/CreateUser.tsx +291 -165
- package/dist/components/layout/SolidAiStudioLayout.d.ts.map +1 -1
- package/dist/components/layout/SolidAiStudioLayout.js +123 -8
- package/dist/components/layout/SolidAiStudioLayout.js.map +1 -1
- package/dist/components/layout/SolidAiStudioLayout.tsx +70 -6
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +10 -6
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +11 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +11 -0
- package/dist/redux/api/apiKeyApi.d.ts +8 -1
- package/dist/redux/api/apiKeyApi.d.ts.map +1 -1
- package/dist/redux/api/apiKeyApi.js +12 -1
- package/dist/redux/api/apiKeyApi.js.map +1 -1
- package/dist/redux/api/apiKeyApi.ts +9 -0
- package/dist/redux/store/defaultStoreConfig.d.ts +16 -1
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/redux/store/defaultStoreConfig.js +3 -1
- package/dist/redux/store/defaultStoreConfig.js.map +1 -1
- package/dist/redux/store/defaultStoreConfig.ts +3 -1
- package/dist/routes/guards/GuestGuard.d.ts +2 -0
- package/dist/routes/guards/GuestGuard.d.ts.map +1 -0
- package/dist/routes/guards/GuestGuard.js +23 -0
- package/dist/routes/guards/GuestGuard.js.map +1 -0
- package/dist/routes/guards/GuestGuard.tsx +24 -0
- package/dist/routes/solidRoutes.d.ts.map +1 -1
- package/dist/routes/solidRoutes.js +2 -1
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +2 -1
- package/dist/types/solid-core.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useFormik } from 'formik';
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react'
|
|
3
3
|
import { CancelButton } from './CancelButton';
|
|
4
|
+
import { ApiKeysTab } from '../core/users/ApiKeysTab';
|
|
5
|
+
import { useSession } from '../../hooks/useSession';
|
|
4
6
|
import { SolidButton, SolidDivider, SolidInput, SolidSegmentedControl, SolidSwitch, SolidTabGroup, SolidTextarea } from '../shad-cn-ui';
|
|
5
7
|
import { usePathname } from "../../hooks/usePathname";
|
|
6
8
|
import SolidLogo from '../../resources/images/SolidXLogo.svg'
|
|
@@ -11,7 +13,7 @@ import { useDropzone } from 'react-dropzone';
|
|
|
11
13
|
import { SettingDropzoneActivePlaceholder } from './SolidSettings/SettingDropzoneActivePlaceholder';
|
|
12
14
|
import { SolidUploadedImage } from './SolidSettings/SolidUploadedImage';
|
|
13
15
|
import { SettingsImageRemoveButton } from './SolidSettings/SettingsImageRemoveButton';
|
|
14
|
-
import { AiModelConfigTab,
|
|
16
|
+
import { AiModelConfigTab, ModelBehavior, ModelEntry, ProviderConfig, SolidAiConfig } from './SolidSettings/LlmSettings/AiModelConfigTab';
|
|
15
17
|
import { useDispatch, useSelector } from 'react-redux';
|
|
16
18
|
import { ERROR_MESSAGES } from '../../constants/error-messages';
|
|
17
19
|
import { useBulkUpdateSolidSettingsMutation, useLazyGetSolidSettingsQuery } from '../../redux/api/solidSettingsApi';
|
|
@@ -20,6 +22,7 @@ import { showToast } from '../../redux/features/toastSlice';
|
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
export const GeneralSettings = () => {
|
|
25
|
+
const { data: session } = useSession();
|
|
23
26
|
const [appLogoPreview, setAppLogoPreview] = useState<string | null>(null);
|
|
24
27
|
const [companyLogoPreview, setCompanyLogoPreview] = useState<string | null>(null);
|
|
25
28
|
const [authScreenRightBackgroundImagePreview, setAuthScreenRightBackgroundImagePreview] = useState<string | null>(null);
|
|
@@ -66,10 +69,23 @@ export const GeneralSettings = () => {
|
|
|
66
69
|
authScreenRightBackgroundImage: solidSettingsData?.data?.authScreenRightBackgroundImage ?? null,
|
|
67
70
|
authScreenLeftBackgroundImage: solidSettingsData?.data?.authScreenLeftBackgroundImage ?? null,
|
|
68
71
|
authScreenCenterBackgroundImage: solidSettingsData?.data?.authScreenCenterBackgroundImage ?? null,
|
|
69
|
-
solidXGenAiCodeBuilderConfig:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
solidXGenAiCodeBuilderConfig: (() => {
|
|
73
|
+
const defaultAiConfig: SolidAiConfig = {
|
|
74
|
+
models: {
|
|
75
|
+
default: { providerKey: "", behavior: { streaming: false, custom: "" } },
|
|
76
|
+
fast: { providerKey: "", behavior: { streaming: false, custom: "" } },
|
|
77
|
+
},
|
|
78
|
+
providers: {},
|
|
79
|
+
};
|
|
80
|
+
const raw = solidSettingsData?.data?.solidXGenAiCodeBuilderConfig;
|
|
81
|
+
if (!raw) return defaultAiConfig;
|
|
82
|
+
try {
|
|
83
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
84
|
+
return (parsed && typeof parsed === "object" ? parsed : defaultAiConfig) as SolidAiConfig;
|
|
85
|
+
} catch {
|
|
86
|
+
return defaultAiConfig;
|
|
87
|
+
}
|
|
88
|
+
})(),
|
|
73
89
|
// llmProvider: solidSettingsData?.data?.llmProvider ?? null,
|
|
74
90
|
// llModelName: solidSettingsData?.data?.llModelName ?? null,
|
|
75
91
|
// llmProviderApiKey: solidSettingsData?.data?.llmProviderApiKey ?? null,
|
|
@@ -339,11 +355,8 @@ export const GeneralSettings = () => {
|
|
|
339
355
|
|
|
340
356
|
|
|
341
357
|
|
|
342
|
-
const
|
|
343
|
-
formik.setFieldValue("solidXGenAiCodeBuilderConfig",
|
|
344
|
-
...formik.values.solidXGenAiCodeBuilderConfig,
|
|
345
|
-
[modelType]: config,
|
|
346
|
-
});
|
|
358
|
+
const handleAiConfigChange = (newConfig: SolidAiConfig) => {
|
|
359
|
+
formik.setFieldValue("solidXGenAiCodeBuilderConfig", newConfig);
|
|
347
360
|
};
|
|
348
361
|
|
|
349
362
|
|
|
@@ -995,10 +1008,14 @@ export const GeneralSettings = () => {
|
|
|
995
1008
|
}
|
|
996
1009
|
{pathname.includes("ai-settings") &&
|
|
997
1010
|
<AiSettingsSection
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1011
|
+
aiConfig={formik.values.solidXGenAiCodeBuilderConfig as SolidAiConfig}
|
|
1012
|
+
onAiConfigChange={handleAiConfigChange}
|
|
1013
|
+
/>
|
|
1014
|
+
}
|
|
1015
|
+
{pathname.includes("api-keys") && session?.user?.id &&
|
|
1016
|
+
<ApiKeysTab
|
|
1017
|
+
userId={session.user.id}
|
|
1018
|
+
canCreate={session?.user?.isAllowedToGenerateApiKeys ?? false}
|
|
1002
1019
|
/>
|
|
1003
1020
|
}
|
|
1004
1021
|
</div>
|
|
@@ -1010,46 +1027,68 @@ export const GeneralSettings = () => {
|
|
|
1010
1027
|
}
|
|
1011
1028
|
|
|
1012
1029
|
const AI_TABS = [
|
|
1013
|
-
{ key: "
|
|
1014
|
-
{ key: "
|
|
1030
|
+
{ key: "fast" as const, label: "Fast Model", title: "Fast Model" },
|
|
1031
|
+
{ key: "default" as const, label: "Intelligent Model", title: "Intelligent Model (Reasoning & tool use)" },
|
|
1015
1032
|
];
|
|
1016
1033
|
|
|
1017
1034
|
interface AiSettingsSectionProps {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
onFastModelChange: (config: ModelConfig) => void;
|
|
1021
|
-
onIntelligentModelChange: (config: ModelConfig) => void;
|
|
1035
|
+
aiConfig: SolidAiConfig;
|
|
1036
|
+
onAiConfigChange: (config: SolidAiConfig) => void;
|
|
1022
1037
|
}
|
|
1023
1038
|
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1039
|
+
const DEFAULT_BEHAVIOR: ModelBehavior = { streaming: false, custom: "" };
|
|
1040
|
+
|
|
1041
|
+
const AiSettingsSection = ({ aiConfig, onAiConfigChange }: AiSettingsSectionProps) => {
|
|
1042
|
+
const [activeTab, setActiveTab] = useState<"fast" | "default">("fast");
|
|
1043
|
+
|
|
1044
|
+
const tabItems = AI_TABS.map((tab) => {
|
|
1045
|
+
const modelEntry: ModelEntry = aiConfig.models?.[tab.key] ?? { providerKey: "", behavior: DEFAULT_BEHAVIOR };
|
|
1046
|
+
const providerKey = modelEntry.providerKey ?? "";
|
|
1047
|
+
const providerConfig: ProviderConfig = aiConfig.providers?.[providerKey] ?? { provider: providerKey, apiKey: "", model: "" };
|
|
1048
|
+
const behavior: ModelBehavior = modelEntry.behavior ?? DEFAULT_BEHAVIOR;
|
|
1049
|
+
|
|
1050
|
+
return {
|
|
1051
|
+
value: tab.key,
|
|
1052
|
+
label: tab.label,
|
|
1053
|
+
content: (
|
|
1054
|
+
<AiModelConfigTab
|
|
1055
|
+
providerKey={providerKey}
|
|
1056
|
+
providerConfig={providerConfig}
|
|
1057
|
+
behavior={behavior}
|
|
1058
|
+
allProviders={aiConfig.providers ?? {}}
|
|
1059
|
+
onProviderKeyChange={(newKey, newConfig) => {
|
|
1060
|
+
onAiConfigChange({
|
|
1061
|
+
...aiConfig,
|
|
1062
|
+
models: { ...aiConfig.models, [tab.key]: { ...modelEntry, providerKey: newKey } },
|
|
1063
|
+
providers: { ...aiConfig.providers, [newKey]: newConfig },
|
|
1064
|
+
});
|
|
1065
|
+
}}
|
|
1066
|
+
onProviderConfigChange={(pk, config) => {
|
|
1067
|
+
onAiConfigChange({
|
|
1068
|
+
...aiConfig,
|
|
1069
|
+
providers: { ...aiConfig.providers, [pk]: config },
|
|
1070
|
+
});
|
|
1071
|
+
}}
|
|
1072
|
+
onBehaviorChange={(newBehavior) => {
|
|
1073
|
+
onAiConfigChange({
|
|
1074
|
+
...aiConfig,
|
|
1075
|
+
models: { ...aiConfig.models, [tab.key]: { ...modelEntry, behavior: newBehavior } },
|
|
1076
|
+
});
|
|
1077
|
+
}}
|
|
1078
|
+
/>
|
|
1079
|
+
),
|
|
1080
|
+
};
|
|
1081
|
+
});
|
|
1043
1082
|
|
|
1044
1083
|
return (
|
|
1045
|
-
<div
|
|
1046
|
-
<p className="solid-settings-heading">
|
|
1084
|
+
<div>
|
|
1085
|
+
<p className="solid-settings-heading" style={{ marginBottom: "1rem" }}>
|
|
1047
1086
|
AI Model Configuration
|
|
1048
1087
|
</p>
|
|
1049
1088
|
<SolidTabGroup
|
|
1050
1089
|
tabs={tabItems}
|
|
1051
1090
|
value={activeTab}
|
|
1052
|
-
onValueChange={(value) => setActiveTab(value as "
|
|
1091
|
+
onValueChange={(value) => setActiveTab(value as "fast" | "default")}
|
|
1053
1092
|
tabPosition="left"
|
|
1054
1093
|
/>
|
|
1055
1094
|
</div>
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ModelBehavior {
|
|
2
|
+
streaming: boolean;
|
|
3
|
+
custom: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ProviderConfig {
|
|
2
6
|
provider: string;
|
|
3
|
-
|
|
7
|
+
apiKey: string;
|
|
8
|
+
model: string;
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ModelEntry {
|
|
12
|
+
providerKey: string;
|
|
13
|
+
behavior: ModelBehavior;
|
|
14
|
+
}
|
|
15
|
+
export interface SolidAiConfig {
|
|
16
|
+
models: {
|
|
17
|
+
default: ModelEntry;
|
|
18
|
+
fast: ModelEntry;
|
|
19
|
+
};
|
|
20
|
+
providers: Record<string, ProviderConfig>;
|
|
4
21
|
}
|
|
5
22
|
interface Props {
|
|
6
|
-
|
|
7
|
-
|
|
23
|
+
providerKey: string;
|
|
24
|
+
providerConfig: ProviderConfig;
|
|
25
|
+
behavior: ModelBehavior;
|
|
26
|
+
allProviders: Record<string, ProviderConfig>;
|
|
27
|
+
onProviderKeyChange: (newProviderKey: string, config: ProviderConfig) => void;
|
|
28
|
+
onProviderConfigChange: (providerKey: string, config: ProviderConfig) => void;
|
|
29
|
+
onBehaviorChange: (behavior: ModelBehavior) => void;
|
|
8
30
|
}
|
|
9
|
-
export declare const AiModelConfigTab: ({
|
|
31
|
+
export declare const AiModelConfigTab: ({ providerKey, providerConfig, behavior, allProviders, onProviderKeyChange, onProviderConfigChange, onBehaviorChange, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
32
|
export {};
|
|
11
33
|
//# sourceMappingURL=AiModelConfigTab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiModelConfigTab.d.ts","sourceRoot":"","sources":["../../../../../src/components/common/SolidSettings/LlmSettings/AiModelConfigTab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AiModelConfigTab.d.ts","sourceRoot":"","sources":["../../../../../src/components/common/SolidSettings/LlmSettings/AiModelConfigTab.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QACN,OAAO,EAAE,UAAU,CAAC;QACpB,IAAI,EAAE,UAAU,CAAC;KAClB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC3C;AAED,UAAU,KAAK;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7C,mBAAmB,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9E,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9E,gBAAgB,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;CACrD;AAkBD,eAAO,MAAM,gBAAgB,4HAQ1B,KAAK,4CA4FP,CAAC"}
|
|
@@ -9,52 +9,40 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { SolidSelect } from "../../../shad-cn-ui";
|
|
23
|
-
import { OpenAiProviderComponent } from "./OpenAiProviderComponent";
|
|
24
|
-
import { AnthropicProviderComponent } from "./AnthropicProviderComponent";
|
|
13
|
+
import { SolidInput, SolidSelect, SolidSwitch, SolidTextarea } from "../../../shad-cn-ui";
|
|
25
14
|
var PROVIDER_OPTIONS = [
|
|
26
15
|
{ label: "OpenAI", value: "openai" },
|
|
27
16
|
{ label: "Anthropic", value: "anthropic" },
|
|
17
|
+
{ label: "OpenAI Compatible", value: "openai-compatible" },
|
|
18
|
+
{ label: "Anthropic Compatible", value: "anthropic-compatible" },
|
|
28
19
|
];
|
|
20
|
+
var COMPATIBLE_PROVIDERS = ["openai-compatible", "anthropic-compatible"];
|
|
21
|
+
var DEFAULT_PROVIDER_CONFIGS = {
|
|
22
|
+
openai: { provider: "openai", apiKey: "", model: "" },
|
|
23
|
+
anthropic: { provider: "anthropic", apiKey: "", model: "" },
|
|
24
|
+
"openai-compatible": { provider: "openai-compatible", apiKey: "", model: "", baseUrl: "" },
|
|
25
|
+
"anthropic-compatible": { provider: "anthropic-compatible", apiKey: "", model: "", baseUrl: "" },
|
|
26
|
+
};
|
|
29
27
|
export var AiModelConfigTab = function (_a) {
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var profiles = (_b = config.availableProviders) !== null && _b !== void 0 ? _b : [];
|
|
33
|
-
var provider = config.provider;
|
|
28
|
+
var providerKey = _a.providerKey, providerConfig = _a.providerConfig, behavior = _a.behavior, allProviders = _a.allProviders, onProviderKeyChange = _a.onProviderKeyChange, onProviderConfigChange = _a.onProviderConfigChange, onBehaviorChange = _a.onBehaviorChange;
|
|
29
|
+
var isCompatible = COMPATIBLE_PROVIDERS.includes(providerKey);
|
|
34
30
|
var handleProviderSelect = function (value) {
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onChange(__assign(__assign({}, config), { provider: value, availableProviders: newProfiles }));
|
|
31
|
+
var _a;
|
|
32
|
+
var existingConfig = allProviders[value];
|
|
33
|
+
var newConfig = (_a = existingConfig !== null && existingConfig !== void 0 ? existingConfig : DEFAULT_PROVIDER_CONFIGS[value]) !== null && _a !== void 0 ? _a : { provider: value, apiKey: "", model: "" };
|
|
34
|
+
onProviderKeyChange(value, newConfig);
|
|
40
35
|
};
|
|
41
|
-
var
|
|
36
|
+
var handleConfigUpdate = function (key, value) {
|
|
42
37
|
var _a;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
else {
|
|
51
|
-
updatedProfiles = __spreadArray(__spreadArray([], profiles, true), [
|
|
52
|
-
(_a = { id: Date.now().toString(), provider: provider }, _a[key] = value, _a),
|
|
53
|
-
], false);
|
|
54
|
-
}
|
|
55
|
-
onChange(__assign(__assign({}, config), { availableProviders: updatedProfiles }));
|
|
38
|
+
onProviderConfigChange(providerKey, __assign(__assign({}, providerConfig), (_a = {}, _a[key] = value, _a)));
|
|
39
|
+
};
|
|
40
|
+
var cardStyle = {
|
|
41
|
+
border: "1px solid var(--solid-border-color, #e2e8f0)",
|
|
42
|
+
borderRadius: "0.5rem",
|
|
43
|
+
padding: "1.25rem",
|
|
44
|
+
background: "var(--solid-card-bg, var(--solid-surface-bg, transparent))",
|
|
56
45
|
};
|
|
57
|
-
|
|
58
|
-
return (_jsxs("div", { className: "ai-model-config-tab", children: [_jsxs("div", { className: "flex flex-column gap-2", children: [_jsx("label", { className: "form-field-label", children: "Provider" }), _jsx(SolidSelect, { className: "w-full", value: provider, options: PROVIDER_OPTIONS, onChange: function (e) { return handleProviderSelect(e.value); }, placeholder: "Select Provider" })] }), provider === "openai" && (_jsx(OpenAiProviderComponent, { profile: currentProfile, onUpdate: handleProfileUpdate })), provider === "anthropic" && (_jsx(AnthropicProviderComponent, { profile: currentProfile, onUpdate: handleProfileUpdate }))] }));
|
|
46
|
+
return (_jsxs("div", { className: "flex flex-column gap-4", children: [_jsxs("div", { style: cardStyle, children: [_jsx("p", { className: "solid-settings-subheading", children: "Provider Config" }), _jsxs("div", { className: "flex flex-column gap-3 mt-3", children: [_jsxs("div", { className: "flex flex-column gap-2", children: [_jsx("label", { className: "form-field-label", children: "Provider" }), _jsx(SolidSelect, { className: "w-full", value: providerKey, options: PROVIDER_OPTIONS, onChange: function (e) { return handleProviderSelect(e.value); }, placeholder: "Select Provider" })] }), isCompatible && (_jsxs("div", { className: "flex flex-column gap-2", children: [_jsx("label", { className: "form-field-label", children: "Base URL" }), _jsx(SolidInput, { placeholder: "http://localhost:8000", value: (providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.baseUrl) || "", onChange: function (e) { return handleConfigUpdate("baseUrl", e.target.value); }, className: "w-full" })] })), _jsxs("div", { className: "flex flex-column gap-2", children: [_jsx("label", { className: "form-field-label", children: "API Key" }), _jsx(SolidInput, { type: "password", className: "w-full", value: (providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey) || "", onChange: function (e) { return handleConfigUpdate("apiKey", e.target.value); } })] }), _jsxs("div", { className: "flex flex-column gap-2", children: [_jsx("label", { className: "form-field-label", children: "Model" }), _jsx(SolidInput, { placeholder: "e.g. gpt-4o-mini", value: (providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.model) || "", onChange: function (e) { return handleConfigUpdate("model", e.target.value); }, className: "w-full" })] })] })] }), _jsxs("div", { style: cardStyle, children: [_jsx("p", { className: "solid-settings-subheading", children: "Behavior" }), _jsxs("div", { className: "flex flex-column gap-3 mt-3", children: [_jsxs("div", { className: "flex align-items-center gap-2", children: [_jsx(SolidSwitch, { checked: behavior.streaming, onChange: function (val) { return onBehaviorChange(__assign(__assign({}, behavior), { streaming: val })); } }), _jsx("label", { className: "form-field-label", style: { marginBottom: 0 }, children: "Streaming" })] }), _jsxs("div", { className: "flex flex-column gap-2", children: [_jsx("label", { className: "form-field-label", children: "Custom Params (JSON)" }), _jsx(SolidTextarea, { value: behavior.custom, onChange: function (e) { return onBehaviorChange(__assign(__assign({}, behavior), { custom: e.target.value })); }, placeholder: '{ "temperature": 0.7, "maxTokens": 1000 }', rows: 4, className: "w-full" })] })] })] })] }));
|
|
59
47
|
};
|
|
60
48
|
//# sourceMappingURL=AiModelConfigTab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiModelConfigTab.js","sourceRoot":"","sources":["../../../../../src/components/common/SolidSettings/LlmSettings/AiModelConfigTab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AiModelConfigTab.js","sourceRoot":"","sources":["../../../../../src/components/common/SolidSettings/LlmSettings/AiModelConfigTab.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAA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AE,CAAC,EAAE,0BAAmB,IAC7E,EACN,eAAK,SAAS,EAAC,wBAAwB,aACrC,gBAAO,SAAS,EAAC,kBAAkB,qCAA6B,EAChE,KAAC,aAAa,IACZ,KAAK,EAAE,QAAQ,CAAC,MAAM,EACtB,QAAQ,EAAE,UAAC,CAAC,IAAK,OAAA,gBAAgB,uBAAM,QAAQ,KAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,IAAG,EAAzD,CAAyD,EAC1E,WAAW,EAAC,2CAA2C,EACvD,IAAI,EAAE,CAAC,EACP,SAAS,EAAC,QAAQ,GAClB,IACE,IACF,IACF,IAEF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { SolidInput, SolidSelect, SolidSwitch, SolidTextarea } from \"../../../shad-cn-ui\";\n\nexport interface ModelBehavior {\n streaming: boolean;\n custom: string;\n}\n\nexport interface ProviderConfig {\n provider: string;\n apiKey: string;\n model: string;\n baseUrl?: string;\n}\n\nexport interface ModelEntry {\n providerKey: string;\n behavior: ModelBehavior;\n}\n\nexport interface SolidAiConfig {\n models: {\n default: ModelEntry;\n fast: ModelEntry;\n };\n providers: Record<string, ProviderConfig>;\n}\n\ninterface Props {\n providerKey: string;\n providerConfig: ProviderConfig;\n behavior: ModelBehavior;\n allProviders: Record<string, ProviderConfig>;\n onProviderKeyChange: (newProviderKey: string, config: ProviderConfig) => void;\n onProviderConfigChange: (providerKey: string, config: ProviderConfig) => void;\n onBehaviorChange: (behavior: ModelBehavior) => void;\n}\n\nconst PROVIDER_OPTIONS = [\n { label: \"OpenAI\", value: \"openai\" },\n { label: \"Anthropic\", value: \"anthropic\" },\n { label: \"OpenAI Compatible\", value: \"openai-compatible\" },\n { label: \"Anthropic Compatible\", value: \"anthropic-compatible\" },\n];\n\nconst COMPATIBLE_PROVIDERS = [\"openai-compatible\", \"anthropic-compatible\"];\n\nconst DEFAULT_PROVIDER_CONFIGS: Record<string, ProviderConfig> = {\n openai: { provider: \"openai\", apiKey: \"\", model: \"\" },\n anthropic: { provider: \"anthropic\", apiKey: \"\", model: \"\" },\n \"openai-compatible\": { provider: \"openai-compatible\", apiKey: \"\", model: \"\", baseUrl: \"\" },\n \"anthropic-compatible\": { provider: \"anthropic-compatible\", apiKey: \"\", model: \"\", baseUrl: \"\" },\n};\n\nexport const AiModelConfigTab = ({\n providerKey,\n providerConfig,\n behavior,\n allProviders,\n onProviderKeyChange,\n onProviderConfigChange,\n onBehaviorChange,\n}: Props) => {\n const isCompatible = COMPATIBLE_PROVIDERS.includes(providerKey);\n\n const handleProviderSelect = (value: string) => {\n const existingConfig = allProviders[value];\n const newConfig = existingConfig ?? DEFAULT_PROVIDER_CONFIGS[value] ?? { provider: value, apiKey: \"\", model: \"\" };\n onProviderKeyChange(value, newConfig);\n };\n\n const handleConfigUpdate = (key: keyof ProviderConfig, value: string) => {\n onProviderConfigChange(providerKey, { ...providerConfig, [key]: value });\n };\n\n const cardStyle: React.CSSProperties = {\n border: \"1px solid var(--solid-border-color, #e2e8f0)\",\n borderRadius: \"0.5rem\",\n padding: \"1.25rem\",\n background: \"var(--solid-card-bg, var(--solid-surface-bg, transparent))\",\n };\n\n return (\n <div className=\"flex flex-column gap-4\">\n <div style={cardStyle}>\n <p className=\"solid-settings-subheading\">Provider Config</p>\n <div className=\"flex flex-column gap-3 mt-3\">\n <div className=\"flex flex-column gap-2\">\n <label className=\"form-field-label\">Provider</label>\n <SolidSelect\n className=\"w-full\"\n value={providerKey}\n options={PROVIDER_OPTIONS}\n onChange={(e) => handleProviderSelect(e.value)}\n placeholder=\"Select Provider\"\n />\n </div>\n {isCompatible && (\n <div className=\"flex flex-column gap-2\">\n <label className=\"form-field-label\">Base URL</label>\n <SolidInput\n placeholder=\"http://localhost:8000\"\n value={providerConfig?.baseUrl || \"\"}\n onChange={(e) => handleConfigUpdate(\"baseUrl\", e.target.value)}\n className=\"w-full\"\n />\n </div>\n )}\n <div className=\"flex flex-column gap-2\">\n <label className=\"form-field-label\">API Key</label>\n <SolidInput\n type=\"password\"\n className=\"w-full\"\n value={providerConfig?.apiKey || \"\"}\n onChange={(e) => handleConfigUpdate(\"apiKey\", e.target.value)}\n />\n </div>\n <div className=\"flex flex-column gap-2\">\n <label className=\"form-field-label\">Model</label>\n <SolidInput\n placeholder=\"e.g. gpt-4o-mini\"\n value={providerConfig?.model || \"\"}\n onChange={(e) => handleConfigUpdate(\"model\", e.target.value)}\n className=\"w-full\"\n />\n </div>\n </div>\n </div>\n\n <div style={cardStyle}>\n <p className=\"solid-settings-subheading\">Behavior</p>\n <div className=\"flex flex-column gap-3 mt-3\">\n <div className=\"flex align-items-center gap-2\">\n <SolidSwitch\n checked={behavior.streaming}\n onChange={(val) => onBehaviorChange({ ...behavior, streaming: val })}\n />\n <label className=\"form-field-label\" style={{ marginBottom: 0 }}>Streaming</label>\n </div>\n <div className=\"flex flex-column gap-2\">\n <label className=\"form-field-label\">Custom Params (JSON)</label>\n <SolidTextarea\n value={behavior.custom}\n onChange={(e) => onBehaviorChange({ ...behavior, custom: e.target.value })}\n placeholder='{ \"temperature\": 0.7, \"maxTokens\": 1000 }'\n rows={4}\n className=\"w-full\"\n />\n </div>\n </div>\n </div>\n\n </div>\n );\n};\n"]}
|
|
@@ -1,76 +1,155 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { AnthropicProviderComponent } from "./AnthropicProviderComponent";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SolidInput, SolidSelect, SolidSwitch, SolidTextarea } from "../../../shad-cn-ui";
|
|
4
3
|
|
|
5
|
-
export interface
|
|
4
|
+
export interface ModelBehavior {
|
|
5
|
+
streaming: boolean;
|
|
6
|
+
custom: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ProviderConfig {
|
|
6
10
|
provider: string;
|
|
7
|
-
|
|
11
|
+
apiKey: string;
|
|
12
|
+
model: string;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ModelEntry {
|
|
17
|
+
providerKey: string;
|
|
18
|
+
behavior: ModelBehavior;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface SolidAiConfig {
|
|
22
|
+
models: {
|
|
23
|
+
default: ModelEntry;
|
|
24
|
+
fast: ModelEntry;
|
|
25
|
+
};
|
|
26
|
+
providers: Record<string, ProviderConfig>;
|
|
8
27
|
}
|
|
9
28
|
|
|
10
29
|
interface Props {
|
|
11
|
-
|
|
12
|
-
|
|
30
|
+
providerKey: string;
|
|
31
|
+
providerConfig: ProviderConfig;
|
|
32
|
+
behavior: ModelBehavior;
|
|
33
|
+
allProviders: Record<string, ProviderConfig>;
|
|
34
|
+
onProviderKeyChange: (newProviderKey: string, config: ProviderConfig) => void;
|
|
35
|
+
onProviderConfigChange: (providerKey: string, config: ProviderConfig) => void;
|
|
36
|
+
onBehaviorChange: (behavior: ModelBehavior) => void;
|
|
13
37
|
}
|
|
14
38
|
|
|
15
39
|
const PROVIDER_OPTIONS = [
|
|
16
40
|
{ label: "OpenAI", value: "openai" },
|
|
17
41
|
{ label: "Anthropic", value: "anthropic" },
|
|
42
|
+
{ label: "OpenAI Compatible", value: "openai-compatible" },
|
|
43
|
+
{ label: "Anthropic Compatible", value: "anthropic-compatible" },
|
|
18
44
|
];
|
|
19
45
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
46
|
+
const COMPATIBLE_PROVIDERS = ["openai-compatible", "anthropic-compatible"];
|
|
47
|
+
|
|
48
|
+
const DEFAULT_PROVIDER_CONFIGS: Record<string, ProviderConfig> = {
|
|
49
|
+
openai: { provider: "openai", apiKey: "", model: "" },
|
|
50
|
+
anthropic: { provider: "anthropic", apiKey: "", model: "" },
|
|
51
|
+
"openai-compatible": { provider: "openai-compatible", apiKey: "", model: "", baseUrl: "" },
|
|
52
|
+
"anthropic-compatible": { provider: "anthropic-compatible", apiKey: "", model: "", baseUrl: "" },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const AiModelConfigTab = ({
|
|
56
|
+
providerKey,
|
|
57
|
+
providerConfig,
|
|
58
|
+
behavior,
|
|
59
|
+
allProviders,
|
|
60
|
+
onProviderKeyChange,
|
|
61
|
+
onProviderConfigChange,
|
|
62
|
+
onBehaviorChange,
|
|
63
|
+
}: Props) => {
|
|
64
|
+
const isCompatible = COMPATIBLE_PROVIDERS.includes(providerKey);
|
|
23
65
|
|
|
24
66
|
const handleProviderSelect = (value: string) => {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
: [...profiles, { id: Date.now().toString(), provider: value }];
|
|
29
|
-
onChange({ ...config, provider: value, availableProviders: newProfiles });
|
|
67
|
+
const existingConfig = allProviders[value];
|
|
68
|
+
const newConfig = existingConfig ?? DEFAULT_PROVIDER_CONFIGS[value] ?? { provider: value, apiKey: "", model: "" };
|
|
69
|
+
onProviderKeyChange(value, newConfig);
|
|
30
70
|
};
|
|
31
71
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
if (profiles.some((p: any) => p.provider === provider)) {
|
|
35
|
-
updatedProfiles = profiles.map((p: any) =>
|
|
36
|
-
p.provider === provider ? { ...p, [key]: value } : p
|
|
37
|
-
);
|
|
38
|
-
} else {
|
|
39
|
-
updatedProfiles = [
|
|
40
|
-
...profiles,
|
|
41
|
-
{ id: Date.now().toString(), provider, [key]: value },
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
onChange({ ...config, availableProviders: updatedProfiles });
|
|
72
|
+
const handleConfigUpdate = (key: keyof ProviderConfig, value: string) => {
|
|
73
|
+
onProviderConfigChange(providerKey, { ...providerConfig, [key]: value });
|
|
45
74
|
};
|
|
46
75
|
|
|
47
|
-
const
|
|
48
|
-
|
|
76
|
+
const cardStyle: React.CSSProperties = {
|
|
77
|
+
border: "1px solid var(--solid-border-color, #e2e8f0)",
|
|
78
|
+
borderRadius: "0.5rem",
|
|
79
|
+
padding: "1.25rem",
|
|
80
|
+
background: "var(--solid-card-bg, var(--solid-surface-bg, transparent))",
|
|
81
|
+
};
|
|
49
82
|
|
|
50
83
|
return (
|
|
51
|
-
<div className="
|
|
52
|
-
<div
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
className="
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
<div className="flex flex-column gap-4">
|
|
85
|
+
<div style={cardStyle}>
|
|
86
|
+
<p className="solid-settings-subheading">Provider Config</p>
|
|
87
|
+
<div className="flex flex-column gap-3 mt-3">
|
|
88
|
+
<div className="flex flex-column gap-2">
|
|
89
|
+
<label className="form-field-label">Provider</label>
|
|
90
|
+
<SolidSelect
|
|
91
|
+
className="w-full"
|
|
92
|
+
value={providerKey}
|
|
93
|
+
options={PROVIDER_OPTIONS}
|
|
94
|
+
onChange={(e) => handleProviderSelect(e.value)}
|
|
95
|
+
placeholder="Select Provider"
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
{isCompatible && (
|
|
99
|
+
<div className="flex flex-column gap-2">
|
|
100
|
+
<label className="form-field-label">Base URL</label>
|
|
101
|
+
<SolidInput
|
|
102
|
+
placeholder="http://localhost:8000"
|
|
103
|
+
value={providerConfig?.baseUrl || ""}
|
|
104
|
+
onChange={(e) => handleConfigUpdate("baseUrl", e.target.value)}
|
|
105
|
+
className="w-full"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
)}
|
|
109
|
+
<div className="flex flex-column gap-2">
|
|
110
|
+
<label className="form-field-label">API Key</label>
|
|
111
|
+
<SolidInput
|
|
112
|
+
type="password"
|
|
113
|
+
className="w-full"
|
|
114
|
+
value={providerConfig?.apiKey || ""}
|
|
115
|
+
onChange={(e) => handleConfigUpdate("apiKey", e.target.value)}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
<div className="flex flex-column gap-2">
|
|
119
|
+
<label className="form-field-label">Model</label>
|
|
120
|
+
<SolidInput
|
|
121
|
+
placeholder="e.g. gpt-4o-mini"
|
|
122
|
+
value={providerConfig?.model || ""}
|
|
123
|
+
onChange={(e) => handleConfigUpdate("model", e.target.value)}
|
|
124
|
+
className="w-full"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
61
128
|
</div>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
129
|
+
|
|
130
|
+
<div style={cardStyle}>
|
|
131
|
+
<p className="solid-settings-subheading">Behavior</p>
|
|
132
|
+
<div className="flex flex-column gap-3 mt-3">
|
|
133
|
+
<div className="flex align-items-center gap-2">
|
|
134
|
+
<SolidSwitch
|
|
135
|
+
checked={behavior.streaming}
|
|
136
|
+
onChange={(val) => onBehaviorChange({ ...behavior, streaming: val })}
|
|
137
|
+
/>
|
|
138
|
+
<label className="form-field-label" style={{ marginBottom: 0 }}>Streaming</label>
|
|
139
|
+
</div>
|
|
140
|
+
<div className="flex flex-column gap-2">
|
|
141
|
+
<label className="form-field-label">Custom Params (JSON)</label>
|
|
142
|
+
<SolidTextarea
|
|
143
|
+
value={behavior.custom}
|
|
144
|
+
onChange={(e) => onBehaviorChange({ ...behavior, custom: e.target.value })}
|
|
145
|
+
placeholder='{ "temperature": 0.7, "maxTokens": 1000 }'
|
|
146
|
+
rows={4}
|
|
147
|
+
className="w-full"
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
74
153
|
</div>
|
|
75
154
|
);
|
|
76
155
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export declare const SolidChatter: ({ modelSingularName, id, refreshChatterMessage, setRefreshChatterMessage, actionsAllowed, title }: {
|
|
1
|
+
export declare const SolidChatter: ({ modelSingularName, id, refreshChatterMessage, setRefreshChatterMessage, actionsAllowed, title, modelUserKey }: {
|
|
2
2
|
modelSingularName: any;
|
|
3
3
|
id: any;
|
|
4
4
|
refreshChatterMessage: boolean;
|
|
5
5
|
setRefreshChatterMessage: (value: boolean) => void;
|
|
6
6
|
actionsAllowed?: string[] | undefined;
|
|
7
7
|
title?: string | undefined;
|
|
8
|
+
modelUserKey?: string | undefined;
|
|
8
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
//# sourceMappingURL=SolidChatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidChatter.d.ts","sourceRoot":"","sources":["../../../../src/components/core/chatter/SolidChatter.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,YAAY;
|
|
1
|
+
{"version":3,"file":"SolidChatter.d.ts","sourceRoot":"","sources":["../../../../src/components/core/chatter/SolidChatter.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,YAAY;uBAA+I,GAAG;QAAM,GAAG;2BAAyB,OAAO;sCAAoC,OAAO,KAAK,IAAI;;;;6CAsPvQ,CAAA"}
|
|
@@ -46,7 +46,7 @@ import { permissionExpression } from '../../../helpers/permissions';
|
|
|
46
46
|
import { SolidButton, SolidMessage } from '../../shad-cn-ui';
|
|
47
47
|
import { Inbox, Loader2 } from 'lucide-react';
|
|
48
48
|
export var SolidChatter = function (_a) {
|
|
49
|
-
var modelSingularName = _a.modelSingularName, id = _a.id, refreshChatterMessage = _a.refreshChatterMessage, setRefreshChatterMessage = _a.setRefreshChatterMessage, _b = _a.actionsAllowed, actionsAllowed = _b === void 0 ? [] : _b, title = _a.title;
|
|
49
|
+
var modelSingularName = _a.modelSingularName, id = _a.id, refreshChatterMessage = _a.refreshChatterMessage, setRefreshChatterMessage = _a.setRefreshChatterMessage, _b = _a.actionsAllowed, actionsAllowed = _b === void 0 ? [] : _b, title = _a.title, modelUserKey = _a.modelUserKey;
|
|
50
50
|
var _c = useState('email-message'), activeTab = _c[0], setActiveTab = _c[1];
|
|
51
51
|
var _d = useState(null), visibleBox = _d[0], setVisibleBox = _d[1];
|
|
52
52
|
var _e = useState([]), messages = _e[0], setMessages = _e[1];
|
|
@@ -206,7 +206,7 @@ export var SolidChatter = function (_a) {
|
|
|
206
206
|
var showDateDivider = index === 0 || message.date !== messages[index - 1].date;
|
|
207
207
|
return (_jsxs("div", { children: [showDateDivider && _jsx(SolidChatterDateDivider, { date: message.date }), _jsx(SolidChatterMessageBox, { user: message.user, messageType: message.messageType, message: message.message, time: message.time, auditRecord: message.auditRecord, media: message.media, messageSubType: message.messageSubType, modelDisplayName: message.modelDisplayName, modelUserKey: message.modelUserKey })] }, message.id));
|
|
208
208
|
}), totalRecords > messages.length && (_jsx("div", { className: 'flex justify-content-center', children: _jsx(SolidButton, { type: 'button', size: 'sm', variant: 'outline', onClick: handleLoadMore, children: "Load more" }) }))] })); };
|
|
209
|
-
return (_jsxs("div", { className: 'h-full', children: [_jsx(SolidChatterHeader, { id: id, refetch: fetchData, modelSingularName: modelSingularName, activeTab: activeTab, handleTabClick: handleTabClick, visibleBox: visibleBox, onFilterChange: handleFilterChange, onComposerCancel: function () { return setVisibleBox(null); }, title: title }), _jsx("div", { className: 'solid-chatter-body', style: {
|
|
209
|
+
return (_jsxs("div", { className: 'h-full', children: [_jsx(SolidChatterHeader, { id: id, refetch: fetchData, modelSingularName: modelSingularName, activeTab: activeTab, handleTabClick: handleTabClick, visibleBox: visibleBox, onFilterChange: handleFilterChange, onComposerCancel: function () { return setVisibleBox(null); }, title: title, modelUserKey: modelUserKey }), _jsx("div", { className: 'solid-chatter-body', style: {
|
|
210
210
|
height: visibleBox === 'email-message'
|
|
211
211
|
? 'calc(100vh - 196px)'
|
|
212
212
|
: visibleBox === 'log'
|