diff --git a/web/src/app/admin/assistants/AssistantEditor.tsx b/web/src/app/admin/assistants/AssistantEditor.tsx index a1f9e5a04..63d10b6c0 100644 --- a/web/src/app/admin/assistants/AssistantEditor.tsx +++ b/web/src/app/admin/assistants/AssistantEditor.tsx @@ -175,7 +175,9 @@ export function AssistantEditor({ starter_messages: existingPersona?.starter_messages ?? [], // EE Only groups: existingPersona?.groups ?? [], - search_tool_enabled: personaCurrentToolIds.includes(searchTool!.id), + search_tool_enabled: existingPersona + ? personaCurrentToolIds.includes(searchTool!.id) + : ccPairs.length > 0, image_generation_tool_enabled: imageGenerationTool ? personaCurrentToolIds.includes(imageGenerationTool.id) : false, @@ -251,7 +253,7 @@ export function AssistantEditor({ formikHelpers.setSubmitting(true); const tools = []; - if (values.search_tool_enabled) { + if (values.search_tool_enabled && ccPairs.length > 0) { tools.push(searchTool!.id); } if ( @@ -397,133 +399,145 @@ export function AssistantEditor({ <> - { - setFieldValue("num_chunks", null); - setFieldValue("search_tool_enabled", e.target.checked); - }} - /> + {ccPairs.length > 0 && ( + <> + { + setFieldValue("num_chunks", null); + setFieldValue( + "search_tool_enabled", + e.target.checked + ); + }} + /> - {values.search_tool_enabled && ( -
- {ccPairs.length > 0 && ( - <> - + {values.search_tool_enabled && ( +
+ {ccPairs.length > 0 && ( + <> + + +
+ + <> + Select which{" "} + {!user || user.role === "admin" ? ( + + Document Sets + + ) : ( + "Document Sets" + )}{" "} + that this Assistant should search through. + If none are specified, the Assistant will + search through all available documents in + order to try and respond to queries. + + +
+ + {documentSets.length > 0 ? ( + ( +
+
+ {documentSets.map((documentSet) => { + const ind = + values.document_set_ids.indexOf( + documentSet.id + ); + let isSelected = ind !== -1; + return ( + { + if (isSelected) { + arrayHelpers.remove(ind); + } else { + arrayHelpers.push( + documentSet.id + ); + } + }} + /> + ); + })} +
+
+ )} + /> + ) : ( + + No Document Sets available.{" "} + {user?.role !== "admin" && ( + <> + If this functionality would be useful, + reach out to the administrators of Danswer + for assistance. + + )} + + )} -
- <> - Select which{" "} - {!user || user.role === "admin" ? ( - - Document Sets - - ) : ( - "Document Sets" - )}{" "} - that this Assistant should search through. If - none are specified, the Assistant will search - through all available documents in order to try - and respond to queries. - - -
+ + How many chunks should we feed into the + LLM when generating the final response? + Each chunk is ~400 words long. +
+ } + onChange={(e) => { + const value = e.target.value; + // Allow only integer values + if ( + value === "" || + /^[0-9]+$/.test(value) + ) { + setFieldValue("num_chunks", value); + } + }} + /> - {documentSets.length > 0 ? ( - ( -
-
- {documentSets.map((documentSet) => { - const ind = - values.document_set_ids.indexOf( - documentSet.id - ); - let isSelected = ind !== -1; - return ( - { - if (isSelected) { - arrayHelpers.remove(ind); - } else { - arrayHelpers.push(documentSet.id); - } - }} - /> - ); - })} -
-
- )} - /> - ) : ( - - No Document Sets available.{" "} - {user?.role !== "admin" && ( - <> - If this functionality would be useful, reach - out to the administrators of Danswer for - assistance. - - )} - - )} + - <> - - How many chunks should we feed into the LLM - when generating the final response? Each chunk - is ~400 words long. -
- } - onChange={(e) => { - const value = e.target.value; - // Allow only integer values - if (value === "" || /^[0-9]+$/.test(value)) { - setFieldValue("num_chunks", value); - } - }} - /> + - - - - - - - + /> + + + )} + )} - + )} {imageGenerationTool &&