mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
feat: Enhance GitHubIssuesView with AI profile and worktree integration
- Added support for default AI profile retrieval and integration into task creation, improving user experience in task management. - Implemented current branch detection based on selected worktree, ensuring accurate context for issue handling. - Updated fetchIssues function dependencies to include new profile and branch data, enhancing task creation logic.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
CircleDot,
|
CircleDot,
|
||||||
Loader2,
|
Loader2,
|
||||||
@@ -43,7 +43,7 @@ import { useAppStore } from '@/store/app-store';
|
|||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Markdown } from '@/components/ui/markdown';
|
import { Markdown } from '@/components/ui/markdown';
|
||||||
import { ConfirmDialog } from '@/components/ui/confirm-dialog';
|
import { ConfirmDialog } from '@/components/ui/confirm-dialog';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn, pathsEqual } from '@/lib/utils';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { ValidationDialog } from './github-issues-view/validation-dialog';
|
import { ValidationDialog } from './github-issues-view/validation-dialog';
|
||||||
|
|
||||||
@@ -64,7 +64,36 @@ export function GitHubIssuesView() {
|
|||||||
// Track revalidation confirmation dialog
|
// Track revalidation confirmation dialog
|
||||||
const [showRevalidateConfirm, setShowRevalidateConfirm] = useState(false);
|
const [showRevalidateConfirm, setShowRevalidateConfirm] = useState(false);
|
||||||
const audioRef = useRef<HTMLAudioElement | null>(null);
|
const audioRef = useRef<HTMLAudioElement | null>(null);
|
||||||
const { currentProject, validationModel, muteDoneSound } = useAppStore();
|
const {
|
||||||
|
currentProject,
|
||||||
|
validationModel,
|
||||||
|
muteDoneSound,
|
||||||
|
defaultAIProfileId,
|
||||||
|
aiProfiles,
|
||||||
|
getCurrentWorktree,
|
||||||
|
worktreesByProject,
|
||||||
|
} = useAppStore();
|
||||||
|
|
||||||
|
// Get default AI profile for task creation
|
||||||
|
const defaultProfile = useMemo(() => {
|
||||||
|
if (!defaultAIProfileId) return null;
|
||||||
|
return aiProfiles.find((p) => p.id === defaultAIProfileId) ?? null;
|
||||||
|
}, [defaultAIProfileId, aiProfiles]);
|
||||||
|
|
||||||
|
// Get current branch from selected worktree
|
||||||
|
const currentBranch = useMemo(() => {
|
||||||
|
if (!currentProject?.path) return '';
|
||||||
|
const currentWorktreeInfo = getCurrentWorktree(currentProject.path);
|
||||||
|
const worktrees = worktreesByProject[currentProject.path] ?? [];
|
||||||
|
const currentWorktreePath = currentWorktreeInfo?.path ?? null;
|
||||||
|
|
||||||
|
const selectedWorktree =
|
||||||
|
currentWorktreePath === null
|
||||||
|
? worktrees.find((w) => w.isMain)
|
||||||
|
: worktrees.find((w) => !w.isMain && pathsEqual(w.path, currentWorktreePath));
|
||||||
|
|
||||||
|
return selectedWorktree?.branch || worktrees.find((w) => w.isMain)?.branch || '';
|
||||||
|
}, [currentProject?.path, getCurrentWorktree, worktreesByProject]);
|
||||||
|
|
||||||
const fetchIssues = useCallback(async () => {
|
const fetchIssues = useCallback(async () => {
|
||||||
if (!currentProject?.path) {
|
if (!currentProject?.path) {
|
||||||
@@ -393,9 +422,9 @@ export function GitHubIssuesView() {
|
|||||||
status: 'backlog' as const,
|
status: 'backlog' as const,
|
||||||
passes: false,
|
passes: false,
|
||||||
priority: getFeaturePriority(validation.estimatedComplexity),
|
priority: getFeaturePriority(validation.estimatedComplexity),
|
||||||
model: 'opus' as const,
|
model: defaultProfile?.model ?? 'opus',
|
||||||
thinkingLevel: 'none' as const,
|
thinkingLevel: defaultProfile?.thinkingLevel ?? 'none',
|
||||||
branchName: '',
|
branchName: currentBranch,
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
};
|
};
|
||||||
@@ -412,7 +441,7 @@ export function GitHubIssuesView() {
|
|||||||
toast.error(err instanceof Error ? err.message : 'Failed to create task');
|
toast.error(err instanceof Error ? err.message : 'Failed to create task');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[currentProject?.path]
|
[currentProject?.path, defaultProfile, currentBranch]
|
||||||
);
|
);
|
||||||
|
|
||||||
const formatDate = (dateString: string) => {
|
const formatDate = (dateString: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user