mirror of
https://github.com/jeffusion/gitea-ai-assistant.git
synced 2026-03-27 10:05:50 +00:00
feat(repo): add project-level review prompt with UI redesign
- Add database migration and repository for project review prompts - Add API endpoint for setting project-level prompts - Integrate project prompts into Agent and Codex review flows - Redesign repository management UI with dialog-based prompt editor - Replace flat buttons with Switch for webhook toggle and dedicated prompt button - Add Dialog and DropdownMenu UI components from Radix UI - Add comprehensive tests for wiring and interactions
This commit is contained in:
@@ -11,14 +11,32 @@ export function withGlobalPrompt(systemContent: string, globalPrompt: string | u
|
||||
return `${systemContent}\n\n${globalPrompt}`;
|
||||
}
|
||||
|
||||
export function mergeReviewPrompts(
|
||||
globalPrompt: string | undefined,
|
||||
projectPrompt: string | undefined
|
||||
): string | undefined {
|
||||
const normalized = [globalPrompt, projectPrompt]
|
||||
.map((item) => item?.trim())
|
||||
.filter((item): item is string => !!item && item.length > 0);
|
||||
|
||||
if (normalized.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return normalized.join('\n\n');
|
||||
}
|
||||
|
||||
export function withCoreGlobalPrompt(
|
||||
systemContent: string,
|
||||
globalPrompt: string | undefined,
|
||||
maxChars = 240
|
||||
maxChars?: number
|
||||
): string {
|
||||
if (!globalPrompt || globalPrompt.trim() === '') {
|
||||
return systemContent;
|
||||
}
|
||||
const compact = globalPrompt.trim().slice(0, maxChars);
|
||||
|
||||
const normalized = globalPrompt.trim();
|
||||
const compact =
|
||||
typeof maxChars === 'number' && maxChars > 0 ? normalized.slice(0, maxChars) : normalized;
|
||||
return `${systemContent}\n\n${compact}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user