1+ 'use client' ;
2+
13import Link from 'next/link' ;
4+ import { useState } from 'react' ;
25
36import { AgentSettingsFields } from '@/components/AgentSettingsForm' ;
4- import { Input , Text , Textarea } from '@/components/UI' ;
7+ import { Button , Input , Text , Textarea } from '@/components/UI' ;
58
69type Props = {
710 fields : AgentSettingsFields ;
11+ isNewAssistant : boolean ;
812 nameError ?: string ;
913 setFields : ( fields : AgentSettingsFields ) => void ;
1014} ;
1115
12- export const DefineAssistantStep : React . FC < Props > = ( { fields, nameError, setFields } ) => {
16+ export const DefineAssistantStep : React . FC < Props > = ( {
17+ fields,
18+ isNewAssistant,
19+ nameError,
20+ setFields,
21+ } ) => {
22+ const [ showInstructions , setShowInstructions ] = useState ( ! isNewAssistant ) ;
23+
1324 return (
1425 < div className = "flex flex-col space-y-4" >
1526 < Input
@@ -26,24 +37,33 @@ export const DefineAssistantStep: React.FC<Props> = ({ fields, nameError, setFie
2637 value = { fields . description ?? '' }
2738 onChange = { ( e ) => setFields ( { ...fields , description : e . target . value } ) }
2839 />
29- < Textarea
30- label = "Instructions"
31- labelTooltip = {
32- < Text >
33- Learn about writing a custom assistant instructions with{ ' ' }
34- < Link
35- href = "https://docs.cohere.com/docs/preambles#advanced-techniques-for-writing-a-preamble"
36- className = "underline"
37- >
38- Cohere's guide
39- </ Link >
40- </ Text >
41- }
42- placeholder = "e.g., You are friendly and helpful. You answer questions based on files in Google Drive."
43- defaultRows = { 8 }
44- value = { fields . preamble || '' }
45- onChange = { ( e ) => setFields ( { ...fields , preamble : e . target . value } ) }
46- />
40+ { showInstructions ? (
41+ < Textarea
42+ label = "Instructions"
43+ labelTooltip = {
44+ < Text >
45+ Learn about writing a custom assistant instructions with{ ' ' }
46+ < Link
47+ href = "https://docs.cohere.com/docs/preambles#advanced-techniques-for-writing-a-preamble"
48+ className = "underline"
49+ >
50+ Cohere's guide
51+ </ Link >
52+ </ Text >
53+ }
54+ placeholder = "e.g., You are friendly and helpful. You answer questions based on files in Google Drive."
55+ defaultRows = { 8 }
56+ value = { fields . preamble || '' }
57+ onChange = { ( e ) => setFields ( { ...fields , preamble : e . target . value } ) }
58+ />
59+ ) : (
60+ < Button
61+ label = "Custom assistant instructions"
62+ icon = "add"
63+ kind = "secondary"
64+ onClick = { ( ) => setShowInstructions ( true ) }
65+ />
66+ ) }
4767 </ div >
4868 ) ;
4969} ;
0 commit comments