allow change of workspace for embedconfig
This commit is contained in:
parent
51765cfe97
commit
5145499776
|
@ -130,7 +130,7 @@ export const WorkspaceSelection = ({ defaultValue = null }) => {
|
|||
<div>
|
||||
<div className="flex flex-col mb-2">
|
||||
<label
|
||||
htmlFor="workspaceId"
|
||||
htmlFor="workspace_id"
|
||||
className="block text-sm font-medium text-white"
|
||||
>
|
||||
Workspace
|
||||
|
@ -141,13 +141,20 @@ export const WorkspaceSelection = ({ defaultValue = null }) => {
|
|||
</p>
|
||||
</div>
|
||||
<select
|
||||
name="workspaceId"
|
||||
name="workspace_id"
|
||||
required={true}
|
||||
defaultValue={defaultValue}
|
||||
className="min-w-[15rem] rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white border border-gray-500 focus:ring-blue-500 focus:border-blue-500"
|
||||
>
|
||||
{workspaces.map((workspace) => {
|
||||
return <option value={workspace.id}>{workspace.name}</option>;
|
||||
return (
|
||||
<option
|
||||
selected={defaultValue === workspace.id}
|
||||
value={workspace.id}
|
||||
>
|
||||
{workspace.name}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -13,6 +13,7 @@ const EmbedConfig = {
|
|||
"max_chats_per_day",
|
||||
"max_chats_per_session",
|
||||
"chat_mode",
|
||||
"workspace_id",
|
||||
],
|
||||
|
||||
new: async function (data, creatorId = null) {
|
||||
|
@ -48,7 +49,7 @@ const EmbedConfig = {
|
|||
),
|
||||
createdBy: Number(creatorId) ?? null,
|
||||
workspace: {
|
||||
connect: { id: Number(data.workspaceId) },
|
||||
connect: { id: Number(data.workspace_id) },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -185,7 +186,11 @@ const BOOLEAN_KEYS = [
|
|||
"enabled",
|
||||
];
|
||||
|
||||
const NUMBER_KEYS = ["max_chats_per_day", "max_chats_per_session"];
|
||||
const NUMBER_KEYS = [
|
||||
"max_chats_per_day",
|
||||
"max_chats_per_session",
|
||||
"workspace_id",
|
||||
];
|
||||
|
||||
// Helper to validate a data object strictly into the proper format
|
||||
function validatedCreationData(value, field) {
|
||||
|
|
Loading…
Reference in New Issue