Skip to content

Commit

Permalink
fix(frontend): Create a conversation without a query (All-Hands-AI#5711)
Browse files Browse the repository at this point in the history
  • Loading branch information
amanape authored Dec 20, 2024
1 parent aa2f34a commit 3236602
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions frontend/src/components/shared/task-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const TaskForm = React.forwardRef<HTMLFormElement>((_, ref) => {
);
const [inputIsFocused, setInputIsFocused] = React.useState(false);
const newConversationMutation = useMutation({
mutationFn: (variables: { q: string }) => {
dispatch(setInitialQuery(variables.q));
mutationFn: (variables: { q?: string }) => {
if (variables.q) dispatch(setInitialQuery(variables.q));
return OpenHands.newConversation({
githubToken: gitHubToken || undefined,
selectedRepository: selectedRepository || undefined,
Expand All @@ -51,7 +51,7 @@ export const TaskForm = React.forwardRef<HTMLFormElement>((_, ref) => {
onSuccess: ({ conversation_id: conversationId }, { q }) => {
posthog.capture("initial_query_submitted", {
entry_point: "task_form",
query_character_length: q.length,
query_character_length: q?.length,
has_repository: !!selectedRepository,
has_files: files.length > 0,
});
Expand Down Expand Up @@ -88,8 +88,6 @@ export const TaskForm = React.forwardRef<HTMLFormElement>((_, ref) => {
const formData = new FormData(event.currentTarget);

const q = formData.get("q")?.toString();
if (!q) return;

newConversationMutation.mutate({ q });
};

Expand Down

0 comments on commit 3236602

Please sign in to comment.