mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
feat: enhance suggestion generation with model and thinking level overrides
- Updated the generateSuggestions function to accept model and thinking level overrides, allowing for more flexible suggestion generation. - Modified the API client and UI components to support passing these new parameters, improving user control over the suggestion process. - Introduced a new phase model for AI Suggestions in settings, enhancing the overall functionality and user experience.
This commit is contained in:
@@ -34,6 +34,8 @@ import {
|
||||
import { useAppStore, Feature } from '@/store/app-store';
|
||||
import { toast } from 'sonner';
|
||||
import { LogViewer } from '@/components/ui/log-viewer';
|
||||
import { useModelOverride } from '@/components/shared/use-model-override';
|
||||
import { ModelOverrideTrigger } from '@/components/shared/model-override-trigger';
|
||||
|
||||
const logger = createLogger('FeatureSuggestions');
|
||||
|
||||
@@ -104,6 +106,11 @@ export function FeatureSuggestionsDialog({
|
||||
|
||||
const { features, setFeatures } = useAppStore();
|
||||
|
||||
// Model override for suggestions
|
||||
const { effectiveModelEntry, isOverridden, setOverride } = useModelOverride({
|
||||
phase: 'suggestionsModel',
|
||||
});
|
||||
|
||||
// Initialize selectedIds when suggestions change
|
||||
useEffect(() => {
|
||||
if (suggestions.length > 0 && selectedIds.size === 0) {
|
||||
@@ -173,7 +180,13 @@ export function FeatureSuggestionsDialog({
|
||||
setCurrentSuggestionType(suggestionType);
|
||||
|
||||
try {
|
||||
const result = await api.suggestions.generate(projectPath, suggestionType);
|
||||
// Pass model and thinkingLevel from the effective model entry
|
||||
const result = await api.suggestions.generate(
|
||||
projectPath,
|
||||
suggestionType,
|
||||
effectiveModelEntry.model,
|
||||
effectiveModelEntry.thinkingLevel
|
||||
);
|
||||
if (!result.success) {
|
||||
toast.error(result.error || 'Failed to start generation');
|
||||
setIsGenerating(false);
|
||||
@@ -184,7 +197,7 @@ export function FeatureSuggestionsDialog({
|
||||
setIsGenerating(false);
|
||||
}
|
||||
},
|
||||
[projectPath, setIsGenerating, setSuggestions]
|
||||
[projectPath, setIsGenerating, setSuggestions, effectiveModelEntry]
|
||||
);
|
||||
|
||||
// Stop generating
|
||||
@@ -330,6 +343,14 @@ export function FeatureSuggestionsDialog({
|
||||
AI Suggestions
|
||||
</>
|
||||
)}
|
||||
<ModelOverrideTrigger
|
||||
currentModelEntry={effectiveModelEntry}
|
||||
onModelChange={setOverride}
|
||||
phase="suggestionsModel"
|
||||
isOverridden={isOverridden}
|
||||
size="sm"
|
||||
variant="icon"
|
||||
/>
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
{currentConfig
|
||||
|
||||
@@ -14,6 +14,7 @@ import type {
|
||||
ModelAlias,
|
||||
GitHubComment,
|
||||
IssueCommentsResult,
|
||||
ThinkingLevel,
|
||||
} from '@automaker/types';
|
||||
import { getJSON, setJSON, removeItem } from './storage';
|
||||
|
||||
@@ -282,7 +283,9 @@ export type SuggestionType = 'features' | 'refactoring' | 'security' | 'performa
|
||||
export interface SuggestionsAPI {
|
||||
generate: (
|
||||
projectPath: string,
|
||||
suggestionType?: SuggestionType
|
||||
suggestionType?: SuggestionType,
|
||||
model?: string,
|
||||
thinkingLevel?: ThinkingLevel
|
||||
) => Promise<{ success: boolean; error?: string }>;
|
||||
stop: () => Promise<{ success: boolean; error?: string }>;
|
||||
status: () => Promise<{
|
||||
@@ -2065,7 +2068,12 @@ let mockSuggestionsTimeout: NodeJS.Timeout | null = null;
|
||||
|
||||
function createMockSuggestionsAPI(): SuggestionsAPI {
|
||||
return {
|
||||
generate: async (projectPath: string, suggestionType: SuggestionType = 'features') => {
|
||||
generate: async (
|
||||
projectPath: string,
|
||||
suggestionType: SuggestionType = 'features',
|
||||
model?: string,
|
||||
thinkingLevel?: ThinkingLevel
|
||||
) => {
|
||||
if (mockSuggestionsRunning) {
|
||||
return {
|
||||
success: false,
|
||||
@@ -2074,7 +2082,11 @@ function createMockSuggestionsAPI(): SuggestionsAPI {
|
||||
}
|
||||
|
||||
mockSuggestionsRunning = true;
|
||||
logger.info(`Mock generating ${suggestionType} suggestions for: ${projectPath}`);
|
||||
logger.info(
|
||||
`Mock generating ${suggestionType} suggestions for: ${projectPath}` +
|
||||
(model ? ` with model: ${model}` : '') +
|
||||
(thinkingLevel ? ` thinkingLevel: ${thinkingLevel}` : '')
|
||||
);
|
||||
|
||||
// Simulate async suggestion generation
|
||||
simulateSuggestionsGeneration(suggestionType);
|
||||
|
||||
@@ -1305,8 +1305,13 @@ export class HttpApiClient implements ElectronAPI {
|
||||
|
||||
// Suggestions API
|
||||
suggestions: SuggestionsAPI = {
|
||||
generate: (projectPath: string, suggestionType?: SuggestionType) =>
|
||||
this.post('/api/suggestions/generate', { projectPath, suggestionType }),
|
||||
generate: (
|
||||
projectPath: string,
|
||||
suggestionType?: SuggestionType,
|
||||
model?: string,
|
||||
thinkingLevel?: string
|
||||
) =>
|
||||
this.post('/api/suggestions/generate', { projectPath, suggestionType, model, thinkingLevel }),
|
||||
stop: () => this.post('/api/suggestions/stop'),
|
||||
status: () => this.get('/api/suggestions/status'),
|
||||
onEvent: (callback: (event: SuggestionsEvent) => void) => {
|
||||
|
||||
Reference in New Issue
Block a user