Merge branch 'dev' into cz/fixTestsCI
This commit is contained in:
commit
00f6bea71b
47 changed files with 1017 additions and 339 deletions
|
|
@ -4,7 +4,7 @@ import { Label } from "../../components/ui/label";
|
|||
import { Textarea } from "../../components/ui/textarea";
|
||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||
import { InputProps } from "../../types/components";
|
||||
import { cn } from "../../utils/utils";
|
||||
import { cn, isEndpointNameValid } from "../../utils/utils";
|
||||
|
||||
export const EditFlowSettings: React.FC<InputProps> = ({
|
||||
name,
|
||||
|
|
@ -17,7 +17,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
|||
setEndpointName,
|
||||
}: InputProps): JSX.Element => {
|
||||
const [isMaxLength, setIsMaxLength] = useState(false);
|
||||
const [isEndpointNameValid, setIsEndpointNameValid] = useState(true);
|
||||
const [validEndpointName, setValidEndpointName] = useState(true);
|
||||
const [isInvalidName, setIsInvalidName] = useState(false);
|
||||
const currentFlow = useFlowsManagerStore((state) => state.currentFlow);
|
||||
|
||||
|
|
@ -34,10 +34,6 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
|||
invalid = true;
|
||||
break;
|
||||
}
|
||||
if (value === currentFlow?.name) {
|
||||
invalid = true;
|
||||
break;
|
||||
}
|
||||
invalid = false;
|
||||
}
|
||||
setIsInvalidName(invalid);
|
||||
|
|
@ -51,12 +47,8 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
|||
const handleEndpointNameChange = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
// Validate the endpoint name
|
||||
// use this regex r'^[a-zA-Z0-9_-]+$'
|
||||
const isValid =
|
||||
(/^[a-zA-Z0-9_-]+$/.test(event.target.value) &&
|
||||
event.target.value.length <= maxLength) ||
|
||||
// empty is also valid
|
||||
event.target.value.length === 0;
|
||||
setIsEndpointNameValid(isValid);
|
||||
const isValid = isEndpointNameValid(event.target.value, maxLength);
|
||||
setValidEndpointName(isValid);
|
||||
setEndpointName!(event.target.value);
|
||||
};
|
||||
|
||||
|
|
@ -115,21 +107,21 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
|||
}}
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
<div
|
||||
className={cn(
|
||||
"font-normal text-muted-foreground word-break-break-word",
|
||||
"max-h-[250px] overflow-auto font-normal text-muted-foreground word-break-break-word",
|
||||
description === "" ? "font-light italic" : "",
|
||||
)}
|
||||
>
|
||||
{description === "" ? "No description" : description}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</Label>
|
||||
{setEndpointName && (
|
||||
<Label>
|
||||
<div className="edit-flow-arrangement mt-3">
|
||||
<span className="font-medium">Endpoint Name</span>
|
||||
{!isEndpointNameValid && (
|
||||
{!validEndpointName && (
|
||||
<span className="edit-flow-span">
|
||||
Invalid endpoint name. Use only letters, numbers, hyphens, and
|
||||
underscores ({maxLength} characters max).
|
||||
|
|
|
|||
|
|
@ -1112,7 +1112,7 @@ export async function getMessagesTable(
|
|||
return { rows: rowsOrganized, columns };
|
||||
}
|
||||
|
||||
export async function deleteMessagesFn(ids: number[]) {
|
||||
export async function deleteMessagesFn(ids: string[]) {
|
||||
try {
|
||||
return await api.delete(`${BASE_URL_API}monitor/messages`, {
|
||||
data: ids,
|
||||
|
|
@ -1124,5 +1124,5 @@ export async function deleteMessagesFn(ids: number[]) {
|
|||
}
|
||||
|
||||
export async function updateMessageApi(data: Message) {
|
||||
return await api.post(`${BASE_URL_API}monitor/messages/${data.index}`, data);
|
||||
return await api.post(`${BASE_URL_API}monitor/messages/${data.id}`, data);
|
||||
}
|
||||
|
|
|
|||
61
src/frontend/src/icons/Firecrawl/FirecrawlLogo.jsx
Normal file
61
src/frontend/src/icons/Firecrawl/FirecrawlLogo.jsx
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
const SvgFirecrawlLogo = (props) => (
|
||||
<svg
|
||||
viewBox="-33 0 255 255"
|
||||
width="24"
|
||||
height="24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlnsXlink="http://www.w3.org/1999/xlink"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
>
|
||||
<defs>
|
||||
<style>
|
||||
{`
|
||||
.cls-3 {
|
||||
fill: url(#linear-gradient-1);
|
||||
}
|
||||
|
||||
.cls-4 {
|
||||
fill: #fc9502;
|
||||
}
|
||||
|
||||
.cls-5 {
|
||||
fill: #fce202;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
|
||||
<linearGradient
|
||||
id="linear-gradient-1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="94.141"
|
||||
y1="255"
|
||||
x2="94.141"
|
||||
y2="0.188"
|
||||
>
|
||||
<stop offset="0" stopColor="#ff4c0d" />
|
||||
<stop offset="1" stopColor="#fc9502" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="fire">
|
||||
<path
|
||||
d="M187.899,164.809 C185.803,214.868 144.574,254.812 94.000,254.812 C42.085,254.812 -0.000,211.312 -0.000,160.812 C-0.000,154.062 -0.121,140.572 10.000,117.812 C16.057,104.191 19.856,95.634 22.000,87.812 C23.178,83.513 25.469,76.683 32.000,87.812 C35.851,94.374 36.000,103.812 36.000,103.812 C36.000,103.812 50.328,92.817 60.000,71.812 C74.179,41.019 62.866,22.612 59.000,9.812 C57.662,5.384 56.822,-2.574 66.000,0.812 C75.352,4.263 100.076,21.570 113.000,39.812 C131.445,65.847 138.000,90.812 138.000,90.812 C138.000,90.812 143.906,83.482 146.000,75.812 C148.365,67.151 148.400,58.573 155.999,67.813 C163.226,76.600 173.959,93.113 180.000,108.812 C190.969,137.321 187.899,164.809 187.899,164.809 Z"
|
||||
id="path-1"
|
||||
className="cls-3"
|
||||
fillRule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M94.000,254.812 C58.101,254.812 29.000,225.711 29.000,189.812 C29.000,168.151 37.729,155.000 55.896,137.166 C67.528,125.747 78.415,111.722 83.042,102.172 C83.953,100.292 86.026,90.495 94.019,101.966 C98.212,107.982 104.785,118.681 109.000,127.812 C116.266,143.555 118.000,158.812 118.000,158.812 C118.000,158.812 125.121,154.616 130.000,143.812 C131.573,140.330 134.753,127.148 143.643,140.328 C150.166,150.000 159.127,167.390 159.000,189.812 C159.000,225.711 129.898,254.812 94.000,254.812 Z"
|
||||
id="path-2"
|
||||
className="cls-4"
|
||||
fillRule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M95.000,183.812 C104.250,183.812 104.250,200.941 116.000,223.812 C123.824,239.041 112.121,254.812 95.000,254.812 C77.879,254.812 69.000,240.933 69.000,223.812 C69.000,206.692 85.750,183.812 95.000,183.812 Z"
|
||||
id="path-3"
|
||||
className="cls-5"
|
||||
fillRule="evenodd"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
export default SvgFirecrawlLogo;
|
||||
28
src/frontend/src/icons/Firecrawl/firecraw-logo.svg
Normal file
28
src/frontend/src/icons/Firecrawl/firecraw-logo.svg
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<svg width="800px" height="800px" viewBox="-33 0 255 255" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
||||
<defs>
|
||||
<style>
|
||||
|
||||
.cls-3 {
|
||||
fill: url(#linear-gradient-1);
|
||||
}
|
||||
|
||||
.cls-4 {
|
||||
fill: #fc9502;
|
||||
}
|
||||
|
||||
.cls-5 {
|
||||
fill: #fce202;
|
||||
}
|
||||
</style>
|
||||
|
||||
<linearGradient id="linear-gradient-1" gradientUnits="userSpaceOnUse" x1="94.141" y1="255" x2="94.141" y2="0.188">
|
||||
<stop offset="0" stop-color="#ff4c0d"/>
|
||||
<stop offset="1" stop-color="#fc9502"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="fire">
|
||||
<path d="M187.899,164.809 C185.803,214.868 144.574,254.812 94.000,254.812 C42.085,254.812 -0.000,211.312 -0.000,160.812 C-0.000,154.062 -0.121,140.572 10.000,117.812 C16.057,104.191 19.856,95.634 22.000,87.812 C23.178,83.513 25.469,76.683 32.000,87.812 C35.851,94.374 36.000,103.812 36.000,103.812 C36.000,103.812 50.328,92.817 60.000,71.812 C74.179,41.019 62.866,22.612 59.000,9.812 C57.662,5.384 56.822,-2.574 66.000,0.812 C75.352,4.263 100.076,21.570 113.000,39.812 C131.445,65.847 138.000,90.812 138.000,90.812 C138.000,90.812 143.906,83.482 146.000,75.812 C148.365,67.151 148.400,58.573 155.999,67.813 C163.226,76.600 173.959,93.113 180.000,108.812 C190.969,137.321 187.899,164.809 187.899,164.809 Z" id="path-1" class="cls-3" fill-rule="evenodd"/>
|
||||
<path d="M94.000,254.812 C58.101,254.812 29.000,225.711 29.000,189.812 C29.000,168.151 37.729,155.000 55.896,137.166 C67.528,125.747 78.415,111.722 83.042,102.172 C83.953,100.292 86.026,90.495 94.019,101.966 C98.212,107.982 104.785,118.681 109.000,127.812 C116.266,143.555 118.000,158.812 118.000,158.812 C118.000,158.812 125.121,154.616 130.000,143.812 C131.573,140.330 134.753,127.148 143.643,140.328 C150.166,150.000 159.127,167.390 159.000,189.812 C159.000,225.711 129.898,254.812 94.000,254.812 Z" id="path-2" class="cls-4" fill-rule="evenodd"/>
|
||||
<path d="M95.000,183.812 C104.250,183.812 104.250,200.941 116.000,223.812 C123.824,239.041 112.121,254.812 95.000,254.812 C77.879,254.812 69.000,240.933 69.000,223.812 C69.000,206.692 85.750,183.812 95.000,183.812 Z" id="path-3" class="cls-5" fill-rule="evenodd"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
9
src/frontend/src/icons/Firecrawl/index.tsx
Normal file
9
src/frontend/src/icons/Firecrawl/index.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import React, { forwardRef } from "react";
|
||||
import SvgFirecrawlLogo from "./FirecrawlLogo";
|
||||
|
||||
export const FirecrawlIcon = forwardRef<
|
||||
SVGSVGElement,
|
||||
React.PropsWithChildren<{}>
|
||||
>((props, ref) => {
|
||||
return <SvgFirecrawlLogo ref={ref} {...props} />;
|
||||
});
|
||||
|
|
@ -10,7 +10,7 @@ const useRemoveSession = (setSuccessData, setErrorData) => {
|
|||
await deleteMessagesFn(
|
||||
messages
|
||||
.filter((msg) => msg.session_id === session_id)
|
||||
.map((msg) => msg.index),
|
||||
.map((msg) => msg.id),
|
||||
);
|
||||
deleteSession(session_id);
|
||||
setSuccessData({
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export default function SessionView({ rows }: { rows: Array<any> }) {
|
|||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
||||
|
||||
const [selectedRows, setSelectedRows] = useState<number[]>([]);
|
||||
const [selectedRows, setSelectedRows] = useState<string[]>([]);
|
||||
|
||||
const { handleRemoveMessages } = useRemoveMessages(
|
||||
setSelectedRows,
|
||||
|
|
@ -52,7 +52,8 @@ export default function SessionView({ rows }: { rows: Array<any> }) {
|
|||
]}
|
||||
overlayNoRowsTemplate="No data available"
|
||||
onSelectionChanged={(event: SelectionChangedEvent) => {
|
||||
setSelectedRows(event.api.getSelectedRows().map((row) => row.index));
|
||||
console.log(event.api.getSelectedRows());
|
||||
setSelectedRows(event.api.getSelectedRows().map((row) => row.id));
|
||||
}}
|
||||
rowSelection="multiple"
|
||||
suppressRowClickSelection={true}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import useAlertStore from "../../stores/alertStore";
|
|||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||
import { FlowSettingsPropsType } from "../../types/components";
|
||||
import { FlowType } from "../../types/flow";
|
||||
import { isEndpointNameValid } from "../../utils/utils";
|
||||
import BaseModal from "../baseModal";
|
||||
|
||||
export default function FlowSettingsModal({
|
||||
|
|
@ -22,13 +23,17 @@ export default function FlowSettingsModal({
|
|||
|
||||
const [name, setName] = useState(currentFlow!.name);
|
||||
const [description, setDescription] = useState(currentFlow!.description);
|
||||
const [endpoint_name, setEndpointName] = useState(currentFlow!.endpoint_name);
|
||||
const [endpoint_name, setEndpointName] = useState(
|
||||
currentFlow!.endpoint_name ?? "",
|
||||
);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [disableSave, setDisableSave] = useState(true);
|
||||
function handleClick(): void {
|
||||
setIsSaving(true);
|
||||
currentFlow!.name = name;
|
||||
currentFlow!.description = description;
|
||||
currentFlow!.endpoint_name = endpoint_name;
|
||||
currentFlow!.endpoint_name =
|
||||
endpoint_name && endpoint_name.length > 0 ? endpoint_name : null;
|
||||
saveFlow(currentFlow!)
|
||||
?.then(() => {
|
||||
setOpen(false);
|
||||
|
|
@ -54,6 +59,18 @@ export default function FlowSettingsModal({
|
|||
setNameList(tempNameList.filter((name) => name !== currentFlow!.name));
|
||||
}, [flows]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
(!nameLists.includes(name) && currentFlow?.name !== name) ||
|
||||
currentFlow?.description !== description ||
|
||||
((currentFlow?.endpoint_name ?? "") !== endpoint_name &&
|
||||
isEndpointNameValid(endpoint_name ?? "", 50))
|
||||
) {
|
||||
setDisableSave(false);
|
||||
} else {
|
||||
setDisableSave(true);
|
||||
}
|
||||
}, [nameLists, currentFlow, description, endpoint_name, name]);
|
||||
return (
|
||||
<BaseModal
|
||||
open={open}
|
||||
|
|
@ -80,8 +97,8 @@ export default function FlowSettingsModal({
|
|||
<BaseModal.Footer
|
||||
submit={{
|
||||
label: "Save",
|
||||
disabled: nameLists.includes(name) || name === currentFlow!.name,
|
||||
dataTestId: "save-flow-settings",
|
||||
disabled: disableSave,
|
||||
loading: isSaving,
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ export default function ShareModal({
|
|||
successShare,
|
||||
(err) => {
|
||||
setErrorData({
|
||||
title: "Error sharing " + is_component ? "component" : "flow",
|
||||
title: "Error sharing " + (is_component ? "component" : "flow"),
|
||||
list: [err["response"]["data"]["detail"]],
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ import { deleteMessagesFn } from "../../../../../controllers/API";
|
|||
import { useMessagesStore } from "../../../../../stores/messagesStore";
|
||||
|
||||
const useRemoveMessages = (
|
||||
setSelectedRows: (data: number[]) => void,
|
||||
setSelectedRows: (data: string[]) => void,
|
||||
setSuccessData: (data: { title: string }) => void,
|
||||
setErrorData: (data: { title: string }) => void,
|
||||
selectedRows: number[],
|
||||
selectedRows: string[],
|
||||
) => {
|
||||
const deleteMessages = useMessagesStore((state) => state.removeMessages);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default function MessagesPage() {
|
|||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
||||
|
||||
const [selectedRows, setSelectedRows] = useState<number[]>([]);
|
||||
const [selectedRows, setSelectedRows] = useState<string[]>([]);
|
||||
|
||||
const { handleRemoveMessages } = useRemoveMessages(
|
||||
setSelectedRows,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export const useMessagesStore = create<MessagesStoreType>((set, get) => ({
|
|||
updateMessage: (message) => {
|
||||
set(() => ({
|
||||
messages: get().messages.map((msg) =>
|
||||
msg.index === message.index ? message : msg,
|
||||
msg.id === message.id ? message : msg,
|
||||
),
|
||||
}));
|
||||
},
|
||||
|
|
@ -41,7 +41,7 @@ export const useMessagesStore = create<MessagesStoreType>((set, get) => ({
|
|||
try {
|
||||
set((state) => {
|
||||
const updatedMessages = state.messages.filter(
|
||||
(msg) => !ids.includes(msg.index),
|
||||
(msg) => !ids.includes(msg.id),
|
||||
);
|
||||
get().setMessages(updatedMessages);
|
||||
resolve(updatedMessages);
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ export type IconComponentProps = {
|
|||
export type InputProps = {
|
||||
name: string | null;
|
||||
description: string | null;
|
||||
endpointName?: string;
|
||||
endpointName?: string | null;
|
||||
maxLength?: number;
|
||||
setName?: (name: string) => void;
|
||||
setDescription?: (description: string) => void;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export type FlowType = {
|
|||
id: string;
|
||||
data: ReactFlowJsonObject | null;
|
||||
description: string;
|
||||
endpoint_name?: string;
|
||||
endpoint_name?: string | null;
|
||||
style?: FlowStyleType;
|
||||
is_component?: boolean;
|
||||
last_tested_version?: string;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
type Message = {
|
||||
artifacts: Record<string, any>;
|
||||
flow_id: string;
|
||||
index: number;
|
||||
message: string;
|
||||
sender: string;
|
||||
sender_name: string;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export type MessagesStoreType = {
|
|||
removeMessage: (message: Message) => void;
|
||||
updateMessage: (message: Message) => void;
|
||||
clearMessages: () => void;
|
||||
removeMessages: (ids: number[]) => void;
|
||||
removeMessages: (ids: string[]) => void;
|
||||
columns: Array<ColDef | ColGroupDef>;
|
||||
setColumns: (columns: Array<ColDef | ColGroupDef>) => void;
|
||||
deleteSession: (id: string) => void;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ import { CouchbaseIcon } from "../icons/Couchbase";
|
|||
import { ElasticsearchIcon } from "../icons/ElasticsearchStore";
|
||||
import { EvernoteIcon } from "../icons/Evernote";
|
||||
import { FBIcon } from "../icons/FacebookMessenger";
|
||||
import { FirecrawlIcon } from "../icons/Firecrawl";
|
||||
import { GitBookIcon } from "../icons/GitBook";
|
||||
import { GoogleIcon } from "../icons/Google";
|
||||
import { GoogleGenerativeAIIcon } from "../icons/GoogleGenerativeAI";
|
||||
|
|
@ -363,6 +364,8 @@ export const nodeIconsLucide: iconsType = {
|
|||
CohereEmbeddings: CohereIcon,
|
||||
EverNoteLoader: EvernoteIcon,
|
||||
FacebookChatLoader: FBIcon,
|
||||
FirecrawlCrawlApi: FirecrawlIcon,
|
||||
FirecrawlScrapeApi: FirecrawlIcon,
|
||||
GitbookLoader: GitBookIcon,
|
||||
GoogleSearchAPIWrapper: GoogleIcon,
|
||||
GoogleSearchResults: GoogleIcon,
|
||||
|
|
|
|||
|
|
@ -463,3 +463,11 @@ export const logTypeIsError = (
|
|||
return isErrorLog(outputs);
|
||||
}
|
||||
};
|
||||
|
||||
export function isEndpointNameValid(name: string, maxLength: number): boolean {
|
||||
return (
|
||||
(/^[a-zA-Z0-9_-]+$/.test(name) && name.length <= maxLength) ||
|
||||
// empty is also valid
|
||||
name.length === 0
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue