clean console log and added toObject() log

This commit is contained in:
anovazzi1 2023-02-19 15:23:31 -03:00
commit fc23bda7b3
5 changed files with 4 additions and 7 deletions

View file

@ -28,14 +28,12 @@ export default function Chat({ reactFlowInstance }) {
ref.current.scrollIntoView({behavior: 'smooth'}); ref.current.scrollIntoView({behavior: 'smooth'});
}, [chatHistory]) }, [chatHistory])
function validateNodes(){ function validateNodes(){
console.log(reactFlowInstance.getNodes());
if(reactFlowInstance.getNodes().some((n) => (n.data.node && Object.keys(n.data.node.template).some((t: any) => ((n.data.node.template[t].required && n.data.node.template[t].value === "") && (n.data.node.template[t].required && !reactFlowInstance.getEdges().some((e) => (e.sourceHandle.split('|')[1] === t && e.sourceHandle.split('|')[2] === n.id)))))))){ if(reactFlowInstance.getNodes().some((n) => (n.data.node && Object.keys(n.data.node.template).some((t: any) => ((n.data.node.template[t].required && n.data.node.template[t].value === "") && (n.data.node.template[t].required && !reactFlowInstance.getEdges().some((e) => (e.sourceHandle.split('|')[1] === t && e.sourceHandle.split('|')[2] === n.id)))))))){
return false; return false;
} }
return true; return true;
} }
function validateChatNodes(){ function validateChatNodes(){
console.log(reactFlowInstance.getNodes());
if(!reactFlowInstance.getNodes().some((n)=> (n.type === 'chatOutputNode')) || !reactFlowInstance.getNodes().some((n)=> (n.type === 'chatInputNode'))){ if(!reactFlowInstance.getNodes().some((n)=> (n.type === 'chatOutputNode')) || !reactFlowInstance.getNodes().some((n)=> (n.type === 'chatInputNode'))){
return false; return false;
} }
@ -103,6 +101,7 @@ export default function Chat({ reactFlowInstance }) {
<div className="absolute inset-y-0 right-0 flex items-center pr-3"> <div className="absolute inset-y-0 right-0 flex items-center pr-3">
<button <button
onClick={() => { onClick={() => {
console.log(reactFlowInstance.toObject())
if(chatValue !== ""){ if(chatValue !== ""){
if(validateNodes()){ if(validateNodes()){
if(validateChatNodes()){ if(validateChatNodes()){

View file

@ -41,7 +41,6 @@ export default function InputListComponent({ value, onChange, disabled}) {
: <button onClick={() => {setInputList((old) => { : <button onClick={() => {setInputList((old) => {
let newInputList = _.cloneDeep(old); let newInputList = _.cloneDeep(old);
newInputList.splice(idx, 1); newInputList.splice(idx, 1);
console.log(newInputList);
return newInputList; return newInputList;
}); });
onChange(inputList);}}> onChange(inputList);}}>

View file

@ -24,7 +24,7 @@ const ConnectionLineComponent = ({
fromNode={}, fromNode={},
connectionLineStyle = {} // provide a default value for connectionLineStyle connectionLineStyle = {} // provide a default value for connectionLineStyle
}) => { }) => {
console.log(fromNode) // console.log(fromNode)
return ( return (
<g> <g>
<path <path

View file

@ -12,14 +12,14 @@ export default function ExtraSidebar() {
acc[c] = curr; acc[c] = curr;
data[curr][c].base_classes?.forEach((b) => {acc[b] = curr;}) data[curr][c].base_classes?.forEach((b) => {acc[b] = curr;})
}); });
console.log(acc); // console.log(acc);
return acc; return acc;
}, {str: 'advanced', bool: 'advanced', chatOutput: 'chat', chatInput: 'chat'}); }, {str: 'advanced', bool: 'advanced', chatOutput: 'chat', chatInput: 'chat'});
useEffect(() => { useEffect(() => {
getAll().then((d) => { getAll().then((d) => {
setData(d.data); setData(d.data);
console.log(d.data); // console.log(d.data);
}); });
}, []); }, []);

View file

@ -310,7 +310,6 @@ export function toFirstUpperCase(str: string) {
} }
export function snakeToNormalCase(str: string) { export function snakeToNormalCase(str: string) {
console.log(str);
return str return str
.split("_") .split("_")
.map((word, index) => { .map((word, index) => {