diff --git a/src/components/chat.tsx b/src/components/chat.tsx index 195ee22..1a4d47b 100644 --- a/src/components/chat.tsx +++ b/src/components/chat.tsx @@ -7,9 +7,7 @@ export function MessageUI(message: ChatMessage) { return (
- {f.description ? f.description.slice(0, 128) + '...' : f.raw_instructions.slice(0, 128) + '...'} + {f.description + ? f.description.slice(0, 128) + '...' + : f.raw_instructions.slice(0, 128) + '...'}
diff --git a/src/components/home/modes/NewFormMode.tsx b/src/components/home/modes/NewFormMode.tsx index 477c9bb..561cb2a 100644 --- a/src/components/home/modes/NewFormMode.tsx +++ b/src/components/home/modes/NewFormMode.tsx @@ -50,21 +50,26 @@ export default function NewFormMode(props: NewFormModeProps) { const conversationThread: ChatMessage[] = [ { role: 'user', - content: 'Here is a short text description of what I want to create a survey form about: ' + formTopic + '\n' + 'What should the title of this survey form be?', - } + content: + 'Here is a short text description of what I want to create a survey form about: ' + + formTopic + + '\n' + + 'What should the title of this survey form be?', + }, ]; const titleResponse = await callLLM(PROMPT_BUILD, conversationThread); if (!titleResponse) { console.error('No response from LLM'); setStep(1); return; - }; + } setTitle(removeStartAndEndQuotes(titleResponse.content) || ''); conversationThread.push(titleResponse); conversationThread.push({ role: 'user', - content: 'Create a short description of this survey form. This description will be given to a person who is in charge of administering the form data collection. This person will use this description to understand what the form is about, so that they can collect the correct information from respondents. Don\'t include information that is not relevant to the form, or state that this is a form. This survey administrator already knows that, instead they care about information relation the forms content. For example, if you want to collect a respondent\'s name and age, you can write: "This form is to collect the names and ages of people attending a birthday party."', + content: + 'Create a short description of this survey form. This description will be given to a person who is in charge of administering the form data collection. This person will use this description to understand what the form is about, so that they can collect the correct information from respondents. Don\'t include information that is not relevant to the form, or state that this is a form. This survey administrator already knows that, instead they care about information relation the forms content. For example, if you want to collect a respondent\'s name and age, you can write: "This form is to collect the names and ages of people attending a birthday party."', }); const descriptionResponse = await callLLM(PROMPT_BUILD, conversationThread); if (!descriptionResponse) { @@ -77,29 +82,39 @@ export default function NewFormMode(props: NewFormModeProps) { conversationThread.push(descriptionResponse); conversationThread.push({ role: 'user', - content: 'Write any guidance that will help respondents fill out this form, such as conditional information to collect or how to answer questions. The survey administrator will reference this guidence when deciding which follow up questions to ask or how to interpret the answers. For example, if you want to collect a RSVP for a birthday party, including the number of guests attending, you may write "Please include the number of guests attending the birthday party, but only if the RSVP is yes." because it doesn\'t make sense to ask for the number of guests if the respondent is not attending.', + content: + 'Write any guidance that will help respondents fill out this form, such as conditional information to collect or how to answer questions. The survey administrator will reference this guidence when deciding which follow up questions to ask or how to interpret the answers. For example, if you want to collect a RSVP for a birthday party, including the number of guests attending, you may write "Please include the number of guests attending the birthday party, but only if the RSVP is yes." because it doesn\'t make sense to ask for the number of guests if the respondent is not attending.', }); - const fieldsGuidanceResponse = await callLLM(PROMPT_BUILD, conversationThread); + const fieldsGuidanceResponse = await callLLM( + PROMPT_BUILD, + conversationThread + ); if (!fieldsGuidanceResponse) { console.error('No response from LLM'); setStep(1); return; - }; - setFieldsGuidance(removeStartAndEndQuotes(fieldsGuidanceResponse.content) || ''); + } + setFieldsGuidance( + removeStartAndEndQuotes(fieldsGuidanceResponse.content) || '' + ); conversationThread.push(fieldsGuidanceResponse); conversationThread.push({ role: 'user', - content: 'Now return a JSON object that will serve as a template for the form responses. This object should have keys that are strings and values that are strings. The keys are the names of the fields that the survey administrator should attempt to obtain. They values should be descriptions of those fields, including any formatting information or non-obvious ways to validate the provided information. For example, if you want to collect a respondent\'s name and age, you can write: {"name": "name of the respondent", "age": "age of the respondent"}', + content: + 'Now return a JSON object that will serve as a template for the form responses. This object should have keys that are strings and values that are strings. The keys are the names of the fields that the survey administrator should attempt to obtain. They values should be descriptions of those fields, including any formatting information or non-obvious ways to validate the provided information. For example, if you want to collect a respondent\'s name and age, you can write: {"name": "name of the respondent", "age": "age of the respondent"}', }); - const fieldsSchemaResponse = await callLLM(PROMPT_BUILD, conversationThread); + const fieldsSchemaResponse = await callLLM( + PROMPT_BUILD, + conversationThread + ); if (!fieldsSchemaResponse) { console.error('No response from LLM'); setStep(1); return; - }; + } const fieldsSchema = fieldsSchemaResponse.content || '{}'; const fieldsSchemaJSON = JSON.parse(fieldsSchema); setFieldsSchema(fieldsSchemaJSON); @@ -108,7 +123,6 @@ export default function NewFormMode(props: NewFormModeProps) { const renderStepContent = () => { if (step === 1) { - return (- {props.content} -
+{props.content}
Name | -Company | -Title | -Tech | -GitHub | -|
---|---|---|---|---|---|
Jane Doe | -jd@ex.co | -Tech Co. | -ML Engineer | -React, Node, Python | -jd-70B | -
Bill Smith | -bsx@ex.co | -Biz Corp. | -Marketing Manager | -Google Analytics | -- | -
Name | +Company | +Title | +Tech | +GitHub | +|
---|---|---|---|---|---|
Jane Doe | +jd@ex.co | +Tech Co. | +ML Engineer | +React, Node, Python | +jd-70B | +
Bill Smith | +bsx@ex.co | +Biz Corp. | +Marketing Manager | +Google Analytics | +- | +