Skip to content

Commit ba68653

Browse files
authored
Merge pull request #246 from code0-tech/feat/#241
Closing option on AI chat within flow builder
2 parents 69981f0 + 83cb117 commit ba68653

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/packages/ce/src/ai/components/AIChatComponent.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Link from "next/link";
2222
import {StreamLanguage} from "@codemirror/language";
2323
import CardSection from "@code0-tech/pictor/dist/components/card/CardSection";
2424
import {Select} from "@radix-ui/react-select";
25-
import {IconChevronDown, IconPlayerStop, IconSend, IconSparkles2Filled} from "@tabler/icons-react";
25+
import {IconChevronDown, IconPlayerStop, IconSend, IconSparkles2Filled, IconX} from "@tabler/icons-react";
2626
import {AIService} from "@edition/ai/services/AI.service";
2727
import {motion} from "framer-motion";
2828
import {AiGenerateFlowSubscriptionPayload, Flow, NamespaceProject} from "@code0-tech/sagittarius-graphql-types";
@@ -34,12 +34,13 @@ export interface AIChatComponentProps {
3434
flowId?: Flow['id']
3535
prompt?: string
3636
onData?: (data: AiGenerateFlowSubscriptionPayload) => string | void
37+
onClose?: () => void
3738

3839
}
3940

4041
export const AIChatComponent: React.FC<AIChatComponentProps> = (props) => {
4142

42-
const {projectId, flowId, prompt = "", onData} = props
43+
const {projectId, flowId, prompt = "", onData, onClose} = props
4344

4445
const aiService = useService(AIService)
4546
const aiStore = useStore(AIService)
@@ -257,6 +258,11 @@ export const AIChatComponent: React.FC<AIChatComponentProps> = (props) => {
257258
<IconSend size={13}/>
258259
</Button>
259260
)}
261+
{onClose ? (
262+
<Button onClick={onClose} variant={"none"} color={"secondary"}>
263+
<IconX size={13}/>
264+
</Button>
265+
) : null}
260266
</Flex>
261267
</Flex>
262268
</CardSection>

src/packages/ce/src/flow/components/panels/FlowPanelControlComponent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ export const FlowPanelControlComponent: React.FC<FlowPanelControlComponentProps>
240240
)}
241241
<AIChatComponent projectId={projectId}
242242
flowId={flowId}
243-
onData={onAIData}/>
243+
onData={onAIData}
244+
onClose={() => setAiOpen(false)}/>
244245
</Flex>
245246

246247
</HoverCardContent>

0 commit comments

Comments
 (0)