Fix lint and prettier
This commit is contained in:
@@ -19,6 +19,7 @@ export const ScenariosHeader = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GridItem
|
<GridItem
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
ref={ref as any}
|
ref={ref as any}
|
||||||
display="flex"
|
display="flex"
|
||||||
alignItems="flex-end"
|
alignItems="flex-end"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export function escapeQuotes(str: string) {
|
|||||||
|
|
||||||
// Escape regex special characters
|
// Escape regex special characters
|
||||||
export function escapeRegExp(str: string) {
|
export function escapeRegExp(str: string) {
|
||||||
return str.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
return str.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fillTemplate(template: string, variables: VariableMap): string {
|
export function fillTemplate(template: string, variables: VariableMap): string {
|
||||||
|
|||||||
@@ -80,7 +80,9 @@ export const runOneEval = async (
|
|||||||
|
|
||||||
const stringifiedMessage = message.content ?? JSON.stringify(message.function_call);
|
const stringifiedMessage = message.content ?? JSON.stringify(message.function_call);
|
||||||
|
|
||||||
const matchRegex = escapeRegExp(fillTemplate(escapeQuotes(evaluation.value), scenario.variableValues as VariableMap));
|
const matchRegex = escapeRegExp(
|
||||||
|
fillTemplate(escapeQuotes(evaluation.value), scenario.variableValues as VariableMap),
|
||||||
|
);
|
||||||
|
|
||||||
switch (evaluation.evalType) {
|
switch (evaluation.evalType) {
|
||||||
case "CONTAINS":
|
case "CONTAINS":
|
||||||
|
|||||||
@@ -68,22 +68,24 @@ export const useElementDimensions = (): [RefObject<HTMLElement>, Dimensions | un
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (ref.current) {
|
if (ref.current) {
|
||||||
const observer = new ResizeObserver(entries => {
|
const observer = new ResizeObserver((entries) => {
|
||||||
entries.forEach(entry => {
|
entries.forEach((entry) => {
|
||||||
setDimensions(entry.contentRect);
|
setDimensions(entry.contentRect);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
observer.observe(ref.current);
|
const observedRef = ref.current;
|
||||||
|
|
||||||
|
observer.observe(observedRef);
|
||||||
|
|
||||||
// Cleanup the observer on component unmount
|
// Cleanup the observer on component unmount
|
||||||
return () => {
|
return () => {
|
||||||
if (ref.current) {
|
if (observedRef) {
|
||||||
observer.unobserve(ref.current);
|
observer.unobserve(observedRef);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return [ref, dimensions];
|
return [ref, dimensions];
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user