Skip to content

DeepTeam is a framework to red team LLMs and AI agents.

update all components from js to ts

A-Vamshi9e7eca9a2348
diff --git a/docs/src/components/AttackTagsDisplayer/index.jsx b/docs/src/components/AttackTagsDisplayer/index.tsx
similarity index 62%
rename from docs/src/components/AttackTagsDisplayer/index.jsx
rename to docs/src/components/AttackTagsDisplayer/index.tsx
index b46a0f7d..805617d0 100644
--- a/docs/src/components/AttackTagsDisplayer/index.jsx
+++ b/docs/src/components/AttackTagsDisplayer/index.tsx
@@ -1,7 +1,21 @@
import React from "react";
import styles from "./AttackTagsDisplayer.module.css";
-const AttackTagsDisplayer = ({ multiTurn=false, singleTurn=false, encodingBased=false, llmSimulated=false, custom=false }) => {
+interface AttackTagsDisplayerProps {
+ multiTurn?: boolean;
+ singleTurn?: boolean;
+ encodingBased?: boolean;
+ llmSimulated?: boolean;
+ custom?: boolean;
+}
+
+const AttackTagsDisplayer: React.FC<AttackTagsDisplayerProps> = ({
+ multiTurn = false,
+ singleTurn = false,
+ encodingBased = false,
+ llmSimulated = false,
+ custom = false
+}) => {
return (
<div className={styles.tagsDisplayer}>
{multiTurn && <div className={`${styles.pill} ${styles.multiTurn}`}>Multi-turn</div>}
@@ -13,4 +27,4 @@ const AttackTagsDisplayer = ({ multiTurn=false, singleTurn=false, encodingBased=
);
};
-export default AttackTagsDisplayer;
+export default AttackTagsDisplayer;
\ No newline at end of file
diff --git a/docs/src/components/BlogImageDisplayer/index.jsx b/docs/src/components/BlogImageDisplayer/index.tsx
similarity index 60%
rename from docs/src/components/BlogImageDisplayer/index.jsx
rename to docs/src/components/BlogImageDisplayer/index.tsx
index 72ebdb2f..5afba2a4 100644
--- a/docs/src/components/BlogImageDisplayer/index.jsx
+++ b/docs/src/components/BlogImageDisplayer/index.tsx
@@ -1,7 +1,14 @@
import React from "react";
import styles from "./BlogImageDisplayer.module.css";
-const BlogImageDisplayer = ({ src, caption, alt, cover }) => {
+interface BlogImageDisplayerProps {
+ src: string;
+ caption?: string;
+ alt?: string;
+ cover?: boolean;
+}
+
+const BlogImageDisplayer: React.FC<BlogImageDisplayerProps> = ({ src, caption, alt, cover }) => {
return (
<div className={styles.imageContainer} style={{ marginTop: cover ? '1rem' : '' }}>
<img className={styles.image} src={src} alt={alt} style={{ padding: cover ? '0' : '' }}/>
@@ -10,4 +17,4 @@ const BlogImageDisplayer = ({ src, caption, alt, cover }) => {
);
}
-export default BlogImageDisplayer;
+export default BlogImageDisplayer;
\ No newline at end of file
diff --git a/docs/src/components/ColabButton/index.jsx b/docs/src/components/ColabButton/index.tsx
similarity index 65%
rename from docs/src/components/ColabButton/index.jsx
rename to docs/src/components/ColabButton/index.tsx
index 433860e1..d1abba86 100644
--- a/docs/src/components/ColabButton/index.jsx
+++ b/docs/src/components/ColabButton/index.tsx
@@ -1,7 +1,12 @@
import React from 'react';
import styles from './ColabButton.module.css';
-const ColabButton = ({ notebookUrl, className }) => {
+interface ColabButtonProps {
+ notebookUrl: string;
+ className?: string;
+}
+
+const ColabButton: React.FC<ColabButtonProps> = ({ notebookUrl, className }) => {
return (
<a
href={notebookUrl}
@@ -16,4 +21,4 @@ const ColabButton = ({ notebookUrl, className }) => {
);
};
-export default ColabButton;
+export default ColabButton;
\ No newline at end of file
diff --git a/docs/src/components/Envelope/index.jsx b/docs/src/components/Envelope/index.tsx
similarity index 85%
rename from docs/src/components/Envelope/index.jsx
rename to docs/src/components/Envelope/index.tsx
index b0610e9b..9f962b91 100644
--- a/docs/src/components/Envelope/index.jsx
+++ b/docs/src/components/Envelope/index.tsx
@@ -1,7 +1,9 @@
import React from 'react';
import styles from './Envelope.module.css';
-function Envelope(props) {
+interface EnvelopeProps {}
+
+const Envelope: React.FC<EnvelopeProps> = (props) => {
return (
<div className={styles.letterContainer} onClick={() => {window.open('https://confident-ai.com', '_blank');}}>
<div className={styles.letterImage}>
@@ -13,7 +15,7 @@ function Envelope(props) {
<div className={styles.letterContentContainer}>
<img src="/icons/red-logo.svg" style={{width: "30px", height: "30px"}}/>
<div className={styles.letterContext}>
- <span class="lexend-deca" style={{fontSize: "16px"}}>Confident AI</span>
+ <span className="lexend-deca" style={{fontSize: "16px"}}>Confident AI</span>
</div>
</div>
<div className={styles.letterStamp}>
@@ -31,4 +33,4 @@ function Envelope(props) {
)
}
-export default Envelope;
\ No newline at end of file
+export default Envelope;
diff --git a/docs/src/components/Equation/index.jsx b/docs/src/components/Equation/index.tsx
similarity index 72%
rename from docs/src/components/Equation/index.jsx
rename to docs/src/components/Equation/index.tsx
index 9f37bf7e..1f072ba3 100644
--- a/docs/src/components/Equation/index.jsx
+++ b/docs/src/components/Equation/index.tsx
@@ -2,7 +2,11 @@ import React from "react";
import katex from "katex";
import styles from "./Equation.module.css";
-const Equation = (props) => {
+interface EquationProps {
+ formula: string;
+}
+
+const Equation: React.FC<EquationProps> = (props) => {
const html = katex.renderToString(props.formula, {
throwOnError: false,
displayMode: true,
@@ -15,4 +19,4 @@ const Equation = (props) => {
);
};
-export default Equation;
\ No newline at end of file
+export default Equation;
\ No newline at end of file
diff --git a/docs/src/components/FeatureComparisonTable/index.jsx b/docs/src/components/FeatureComparisonTable/index.tsx
similarity index 98%
rename from docs/src/components/FeatureComparisonTable/index.jsx
rename to docs/src/components/FeatureComparisonTable/index.tsx
index 87fffb16..e201032c 100644
--- a/docs/src/components/FeatureComparisonTable/index.jsx
+++ b/docs/src/components/FeatureComparisonTable/index.tsx
@@ -1,7 +1,29 @@
import React from "react";
import styles from "./FeatureComparisonTable.module.css";
-const datasets = {
+
+interface DatasetItem {
+ feature: string;
+ description: string;
+ deepeval: boolean | string;
+ competitor: boolean | string;
+}
+
+interface DatasetCategories {
+ summary?: DatasetItem[];
+ metrics?: DatasetItem[];
+ synthesizer?: DatasetItem[];
+ redTeaming?: DatasetItem[];
+ benchmarks?: DatasetItem[];
+ integrations?: DatasetItem[];
+ platform?: DatasetItem[];
+}
+
+interface Datasets {
+ [key: string]: DatasetCategories;
+}
+
+const datasets: Datasets = {
ragas: {
summary: [
{
@@ -2277,12 +2299,19 @@ const datasets = {
],
},
};
+
+type TopLevel = keyof typeof datasets;
+
+interface FeatureComparisonTableProps {
+ type: `${TopLevel}::${string}`;
+ competitor: string;
+}
-export default function FeatureComparisonTable({ type, competitor }) {
+export default function FeatureComparisonTable({ type, competitor }: FeatureComparisonTableProps) {
const [topKey, subKey] = type.split("::");
- const data = datasets?.[topKey]?.[subKey] || [];
+ const data = datasets[topKey]?.[subKey as keyof (typeof datasets)[typeof topKey]] || [];
- const renderValue = (value) => {
+ const renderValue = (value: string | boolean) => {
if (typeof value === "string") {
return <span className={styles.cellText}>{value}</span>;
}
diff --git a/docs/src/components/GuardTagsDisplayer/index.jsx b/docs/src/components/GuardTagsDisplayer/index.tsx
similarity index 62%
rename from docs/src/components/GuardTagsDisplayer/index.jsx
rename to docs/src/components/GuardTagsDisplayer/index.tsx
index 55708620..6bcdd52b 100644
--- a/docs/src/components/GuardTagsDisplayer/index.jsx
+++ b/docs/src/components/GuardTagsDisplayer/index.tsx
@@ -1,7 +1,19 @@
import React from "react";
import styles from "./GuardTagsDisplayer.module.css";
-const GuardTagsDisplayer = ({ singleTurn=false, usesLLMs=false, input=false, output=false }) => {
+interface GuardTagsDisplayerProps {
+ singleTurn?: boolean;
+ usesLLMs?: boolean;
+ input?: boolean;
+ output?: boolean;
+}
+
+const GuardTagsDisplayer: React.FC<GuardTagsDisplayerProps> = ({
+ singleTurn = false,
+ usesLLMs = false,
+ input = false,
+ output = false
+}) => {
return (
<div className={styles.tagsDisplayer}>
{singleTurn && <div className={`${styles.pill} ${styles.singleTurn}`}>Single-turn</div>}
@@ -12,4 +24,4 @@ const GuardTagsDisplayer = ({ singleTurn=false, usesLLMs=false, input=false, out
);
};
-export default GuardTagsDisplayer;
\ No newline at end of file
+export default GuardTagsDisplayer;
\ No newline at end of file
diff --git a/docs/src/components/VideoDisplayer/index.jsx b/docs/src/components/VideoDisplayer/index.tsx
similarity index 86%
rename from docs/src/components/VideoDisplayer/index.jsx
rename to docs/src/components/VideoDisplayer/index.tsx
index d73ac4ea..9a693731 100644
--- a/docs/src/components/VideoDisplayer/index.jsx
+++ b/docs/src/components/VideoDisplayer/index.tsx
@@ -1,7 +1,13 @@
import React from "react";
import styles from "./VideoDisplayer.module.css";
-const VideoDisplayer = ({ src, confidentUrl, label }) => {
+interface VideoDisplayerProps {
+ src: string;
+ confidentUrl: string;
+ label: string;
+}
+
+const VideoDisplayer: React.FC<VideoDisplayerProps> = ({ src, confidentUrl, label }) => {
return (
<div className={styles.videoContainer}>
<video width="100%" muted controls playsInline controlsList="nodownload">
diff --git a/docs/src/components/index.js b/docs/src/components/index.ts
similarity index 100%
rename from docs/src/components/index.js
rename to docs/src/components/index.ts