formatting code
This commit is contained in:
parent
0db3ed20d8
commit
d0f477e605
6 changed files with 26 additions and 18 deletions
|
|
@ -34,7 +34,12 @@ export default function AccordionComponent({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Accordion type="single" className="w-full" value={value} onValueChange={setValue}>
|
<Accordion
|
||||||
|
type="single"
|
||||||
|
className="w-full"
|
||||||
|
value={value}
|
||||||
|
onValueChange={setValue}
|
||||||
|
>
|
||||||
<AccordionItem value={keyValue} className="border-b">
|
<AccordionItem value={keyValue} className="border-b">
|
||||||
<AccordionTrigger
|
<AccordionTrigger
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ const AccordionContent = React.forwardRef<
|
||||||
<AccordionPrimitive.Content
|
<AccordionPrimitive.Content
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ export default function ChatMessage({
|
||||||
remarkPlugins={[remarkGfm, remarkMath]}
|
remarkPlugins={[remarkGfm, remarkMath]}
|
||||||
rehypePlugins={[rehypeMathjax]}
|
rehypePlugins={[rehypeMathjax]}
|
||||||
className="markdown prose inline-block break-words text-primary
|
className="markdown prose inline-block break-words text-primary
|
||||||
dark:prose-invert sm:max-w-[30vw] lg:max-w-[40vw] sm:w-[30vw] lg:w-[40vw]"
|
dark:prose-invert sm:w-[30vw] sm:max-w-[30vw] lg:w-[40vw] lg:max-w-[40vw]"
|
||||||
components={{
|
components={{
|
||||||
code: ({
|
code: ({
|
||||||
node,
|
node,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import ChatMessage from "./chatMessage";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import AccordionComponent from "../../components/AccordionComponent";
|
import AccordionComponent from "../../components/AccordionComponent";
|
||||||
import ToggleShadComponent from "../../components/toggleShadComponent";
|
import ToggleShadComponent from "../../components/toggleShadComponent";
|
||||||
import { AccordionItem } from "../../components/ui/accordion";
|
|
||||||
import { Badge } from "../../components/ui/badge";
|
import { Badge } from "../../components/ui/badge";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
|
|
@ -420,10 +419,8 @@ export default function FormModal({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{Object.keys(tabsState[id.current].formKeysData.input_keys).map(
|
{Object.keys(tabsState[id.current].formKeysData.input_keys).map(
|
||||||
(i, k) => (
|
(i, k) => (
|
||||||
|
|
||||||
<div className="file-component-accordion-div" key={k}>
|
<div className="file-component-accordion-div" key={k}>
|
||||||
<AccordionComponent
|
<AccordionComponent
|
||||||
trigger={
|
trigger={
|
||||||
|
|
@ -484,7 +481,7 @@ export default function FormModal({
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
{tabsState[id.current].formKeysData.memory_keys.map((i, k) => (
|
{tabsState[id.current].formKeysData.memory_keys.map((i, k) => (
|
||||||
<div className="file-component-accordion-div" key={k}>
|
<div className="file-component-accordion-div" key={k}>
|
||||||
<AccordionComponent
|
<AccordionComponent
|
||||||
trigger={
|
trigger={
|
||||||
<div className="file-component-badge-div">
|
<div className="file-component-badge-div">
|
||||||
|
|
@ -523,9 +520,7 @@ export default function FormModal({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Textarea
|
<Textarea
|
||||||
value={
|
value={tabsState[id.current].formKeysData.input_keys[i]}
|
||||||
tabsState[id.current].formKeysData.input_keys[i]
|
|
||||||
}
|
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setTabsState((old) => {
|
setTabsState((old) => {
|
||||||
let newTabsState = _.cloneDeep(old);
|
let newTabsState = _.cloneDeep(old);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,11 @@ import { Badge } from "../../components/ui/badge";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import { DialogTitle } from "../../components/ui/dialog";
|
import { DialogTitle } from "../../components/ui/dialog";
|
||||||
import { Textarea } from "../../components/ui/textarea";
|
import { Textarea } from "../../components/ui/textarea";
|
||||||
import { MAX_WORDS_HIGHLIGHT, PROMPT_DIALOG_SUBTITLE, TEXT_DIALOG_SUBTITLE } from "../../constants";
|
import {
|
||||||
|
MAX_WORDS_HIGHLIGHT,
|
||||||
|
PROMPT_DIALOG_SUBTITLE,
|
||||||
|
TEXT_DIALOG_SUBTITLE,
|
||||||
|
} from "../../constants";
|
||||||
import { alertContext } from "../../contexts/alertContext";
|
import { alertContext } from "../../contexts/alertContext";
|
||||||
import { darkContext } from "../../contexts/darkContext";
|
import { darkContext } from "../../contexts/darkContext";
|
||||||
import { PopUpContext } from "../../contexts/popUpContext";
|
import { PopUpContext } from "../../contexts/popUpContext";
|
||||||
|
|
@ -120,15 +124,16 @@ export default function GenericModal({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getClassByNumberLength(){
|
function getClassByNumberLength() {
|
||||||
let sumOfCaracteres: number = 0;
|
let sumOfCaracteres: number = 0;
|
||||||
wordsHighlight.forEach(element => {
|
wordsHighlight.forEach((element) => {
|
||||||
sumOfCaracteres = sumOfCaracteres + element.replace(/[{}]/g, "").length
|
sumOfCaracteres = sumOfCaracteres + element.replace(/[{}]/g, "").length;
|
||||||
});
|
});
|
||||||
return sumOfCaracteres > MAX_WORDS_HIGHLIGHT ? "code-highlight" : "code-nohighlight"
|
return sumOfCaracteres > MAX_WORDS_HIGHLIGHT
|
||||||
|
? "code-highlight"
|
||||||
|
: "code-nohighlight";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function validatePrompt(closeModal: boolean) {
|
function validatePrompt(closeModal: boolean) {
|
||||||
postValidatePrompt(field_name, inputValue, nodeClass)
|
postValidatePrompt(field_name, inputValue, nodeClass)
|
||||||
.then((apiReturn) => {
|
.then((apiReturn) => {
|
||||||
|
|
@ -234,7 +239,10 @@ export default function GenericModal({
|
||||||
<div className="mb-auto flex-1">
|
<div className="mb-auto flex-1">
|
||||||
{type === TypeModal.PROMPT && (
|
{type === TypeModal.PROMPT && (
|
||||||
<div className=" mr-2">
|
<div className=" mr-2">
|
||||||
<div ref={divRef} className="max-h-20 overflow-y-auto custom-scroll">
|
<div
|
||||||
|
ref={divRef}
|
||||||
|
className="max-h-20 overflow-y-auto custom-scroll"
|
||||||
|
>
|
||||||
<div className="flex flex-wrap items-center">
|
<div className="flex flex-wrap items-center">
|
||||||
<Variable className=" -ml-px mr-1 flex h-4 w-4 text-primary"></Variable>
|
<Variable className=" -ml-px mr-1 flex h-4 w-4 text-primary"></Variable>
|
||||||
<span className="text-md font-semibold text-primary">
|
<span className="text-md font-semibold text-primary">
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
sans: ["var(--font-sans)", ...fontFamily.sans],
|
sans: ["var(--font-sans)", ...fontFamily.sans],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue