Skip to content

Commit

Permalink
Merge branch 'main' into refactory-conversation-path-method
Browse files Browse the repository at this point in the history
  • Loading branch information
tofarr authored Dec 30, 2024
2 parents 3f131de + d8b33c4 commit 7a417f2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/components/shared/task-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export function TaskForm({ ref }: TaskFormProps) {
const [inputIsFocused, setInputIsFocused] = React.useState(false);
const newConversationMutation = useMutation({
mutationFn: (variables: { q?: string }) => {
if (variables.q) dispatch(setInitialQuery(variables.q));
if (!variables.q?.trim() && !selectedRepository && files.length === 0) {
throw new Error("No query provided");
}

if (variables.q?.trim()) dispatch(setInitialQuery(variables.q));
return OpenHands.newConversation({
githubToken: gitHubToken || undefined,
selectedRepository: selectedRepository || undefined,
Expand Down Expand Up @@ -90,9 +94,7 @@ export function TaskForm({ ref }: TaskFormProps) {
const formData = new FormData(event.currentTarget);

const q = formData.get("q")?.toString();
if (q?.trim()) {
newConversationMutation.mutate({ q });
}
newConversationMutation.mutate({ q });
};

return (
Expand Down

0 comments on commit 7a417f2

Please sign in to comment.