Skip to content

Conversation

@danielfrey63
Copy link

No description provided.

Frey Daniel (IT-PTR-EXT-EXT2 - Extern) added 2 commits December 9, 2025 20:05
- Replace custom Japanese theme with a modern design system using OKLCH colors and clean UI components
- Update wiki generation prompts to enforce full relative file paths for accurate references
- Implement commit-hash based permalinks for source code citations to ensure link stability across branches
- Enhance Markdown rendering to automatically parse and linkify file paths with line numbers
- Refactor global CSS and ThemeProvider to use class-based dark mode strategy
- Update landing page and component styles (TokenInput, WikiTypeSelector, ProcessedProjects) to match new design
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @danielfrey63, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the application's capabilities by integrating Azure AI as a new embedding provider, improving the accuracy and functionality of source code citations within generated wiki pages, and introducing a 'force regeneration' option for better content control. Concurrently, the frontend has undergone a major styling overhaul to a modern design system, complemented by new utility functions for robust local storage handling and comprehensive logging.

Highlights

  • Azure Embedder Support: Integrated Azure AI as a new embedder option, including configuration in api/config.py and api/config/embedder.json, and updated logic in api/tools/embedder.py to utilize it.
  • Enhanced Source Citation in Markdown: Improved markdown rendering to accurately format and link source citations with full relative paths, line numbers, and repository-specific URLs (GitHub, GitLab, Bitbucket). This includes fetching the latest commit hash for precise linking.
  • Force Regeneration Option for Wiki Pages: Introduced a new feature allowing users to force the regeneration of wiki pages, even if valid content already exists. This is useful for correcting previously misgenerated content and is controlled via a new UI option in ModelSelectionModal.tsx.
  • Frontend Styling Overhaul: Refactored the entire CSS variable system in src/app/globals.css to adopt a modern design token approach using oklch colors, replacing the previous Japanese aesthetic with a cleaner, more neutral look. This also includes updates to shadows, buttons, and various component styles.
  • Robust Local Storage and Logging Utilities: Added src/utils/localStorage.ts to provide a safeLocalStorage wrapper, mitigating a Node.js v25 bug, and src/utils/logger.ts for a configurable frontend logging utility with different log levels, enhancing debugging and application stability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@danielfrey63
Copy link
Author

Please delete this pull request - my bad

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Azure embedders by updating configuration files (api/config.py, api/config/embedder.json, api/tools/embedder.py) and the faiss-cpu dependency (api/pyproject.toml). It also significantly refactors the frontend, moving from a Japanese aesthetic CSS theme to a more modern, token-based design (src/app/globals.css, src/app/layout.tsx, src/app/page.tsx, src/components/ProcessedProjects.tsx, src/components/TokenInput.tsx, src/components/WikiTypeSelector.tsx).

Key functional changes include enhanced source citation formatting in prompts (api/prompts.py, api/websocket_wiki.py) to enforce full relative paths and line numbers, and improvements to the wiki generation process (src/app/[owner]/[repo]/page.tsx). The latter now includes content validation, logging, fetching of commit hashes for accurate source linking, and a new 'force regeneration' feature. A safeLocalStorage utility (src/utils/localStorage.ts) was added to mitigate a Node.js v25 bug, and a new logger utility (src/utils/logger.ts) was introduced for structured frontend logging. The Markdown component (src/components/Markdown.tsx) was updated to correctly render and link these new citation formats. The package-lock.json file was updated to reflect peer: true for several dependencies. Internationalization messages were also updated to include text for the new 'force regeneration' option.

Review comments highlighted that the embedder configuration logic in api/config.py could be simplified using a dictionary map for better scalability. Additionally, the logic for fetching commit hashes within src/app/[owner]/[repo]/page.tsx was noted as complex and duplicated, suggesting extraction into a reusable utility function. The generateFileUrl function in src/components/Markdown.tsx was identified as a duplicate of logic in src/app/[owner]/[repo]/page.tsx, recommending it be moved to a shared utility file to adhere to the DRY principle.

Comment on lines 169 to 175
return configs.get("embedder_google", {})
elif embedder_type == 'ollama' and 'embedder_ollama' in configs:
return configs.get("embedder_ollama", {})
elif embedder_type == 'azure' and 'embedder_azure' in configs:
return configs.get("embedder_azure", {})
else:
return configs.get("embedder", {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This if/elif/else chain for selecting the embedder configuration can be simplified and made more scalable by using a dictionary mapping. This avoids adding a new elif block every time a new embedder type is introduced and makes the code easier to read and maintain.

    embedder_type = EMBEDDER_TYPE
    config_map = {
        "google": "embedder_google",
        "ollama": "embedder_ollama",
        "azure": "embedder_azure",
    }
    config_key = config_map.get(embedder_type)
    if config_key and config_key in configs:
        return configs.get(config_key, {})
    return configs.get("embedder", {})

Comment on lines +1865 to +1952
// Fetch commit hash for cached wiki data
console.log('Attempting to fetch commit hash for cached wiki...');
console.log('repoInfoForCommitHash.type:', repoInfoForCommitHash.type);
console.log('repoInfoForCommitHash.repoUrl:', repoInfoForCommitHash.repoUrl);
console.log('repoInfoForCommitHash.owner:', repoInfoForCommitHash.owner);
console.log('repoInfoForCommitHash.repo:', repoInfoForCommitHash.repo);

if (repoInfoForCommitHash.type === 'github' && repoInfoForCommitHash.repoUrl) {
const owner = repoInfoForCommitHash.owner;
const repo = repoInfoForCommitHash.repo;

console.log('Fetching commit hash for:', owner, '/', repo);

const getGithubApiUrl = (repoUrl: string): string => {
try {
const url = new URL(repoUrl);
const hostname = url.hostname;
if (hostname === 'github.com') {
return 'https://api.github.com';
}
return `${url.protocol}//${hostname}/api/v3`;
} catch {
return 'https://api.github.com';
}
};

const createGithubHeaders = (token: string | null) => {
const headers: Record<string, string> = {
'Accept': 'application/vnd.github.v3+json'
};
if (token) {
headers['Authorization'] = `token ${token}`;
}
return headers;
};

const githubApiBaseUrl = getGithubApiUrl(repoInfoForCommitHash.repoUrl!);
const currentToken = repoInfoForCommitHash.type === 'github' ? (typeof window !== 'undefined' ? localStorage.getItem('github_token') : null) :
repoInfoForCommitHash.type === 'gitlab' ? (typeof window !== 'undefined' ? localStorage.getItem('gitlab_token') : null) : null;

console.log('GitHub API URL:', githubApiBaseUrl);
console.log('Has token:', !!currentToken);

try {
const repoInfoResponse = await fetch(`${githubApiBaseUrl}/repos/${owner}/${repo}`, {
headers: createGithubHeaders(currentToken)
});

console.log('Repo info response status:', repoInfoResponse.status);

if (repoInfoResponse.ok) {
const repoData = await repoInfoResponse.json();
const defaultBranchLocal = repoData.default_branch;
setDefaultBranch(defaultBranchLocal || 'main');
console.log('Default branch:', defaultBranchLocal);

// Get the latest commit hash
try {
const branchResponse = await fetch(`${githubApiBaseUrl}/repos/${owner}/${repo}/branches/${defaultBranchLocal || 'main'}`, {
headers: createGithubHeaders(currentToken)
});

console.log('Branch response status:', branchResponse.status);

if (branchResponse.ok) {
const branchData = await branchResponse.json();
const latestCommitHash = branchData.commit?.sha;
if (latestCommitHash) {
setCommitHash(latestCommitHash.substring(0, 8));
console.log(`✅ Found commit hash for cached wiki: ${latestCommitHash.substring(0, 8)}`);
} else {
console.warn('No commit SHA in branch data');
}
} else {
console.warn('Branch response not OK:', await branchResponse.text());
}
} catch (err) {
console.error('Error fetching commit hash for cached wiki:', err);
}
} else {
console.warn('Repo info response not OK:', await repoInfoResponse.text());
}
} catch (err) {
console.error('Error fetching repository info for cached wiki:', err);
}
} else {
console.log('Skipping commit hash fetch - not a GitHub repo or missing repoUrl');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block of code for fetching the commit hash when loading from cache is quite large and complex to be inside a useEffect. It also duplicates some logic for creating GitHub API URLs and headers from fetchRepositoryStructure. Consider extracting this logic into a dedicated, reusable utility function, e.g., fetchRepoDetails(repoInfo, token), which could return the default branch and commit hash. This would significantly improve the readability and maintainability of this useEffect hook.

Comment on lines +18 to +65
const generateFileUrl = (filePath: string, lineStart?: number, lineEnd?: number): string => {
if (!repoUrl) return '';

try {
const url = new URL(repoUrl);
const hostname = url.hostname;
let fileUrl = '';

// Use commit hash if available, otherwise use default branch
const ref = commitHash || defaultBranch;

if (hostname === 'github.com' || hostname.includes('github')) {
// GitHub URL format: https://github.com/owner/repo/blob/commit-hash/path#L1-L50
fileUrl = `${repoUrl}/blob/${ref}/${filePath}`;
if (lineStart) {
fileUrl += `#L${lineStart}`;
if (lineEnd && lineEnd !== lineStart) {
fileUrl += `-L${lineEnd}`;
}
}
return fileUrl;
} else if (hostname === 'gitlab.com' || hostname.includes('gitlab')) {
// GitLab URL format: https://gitlab.com/owner/repo/-/blob/commit-hash/path#L1-50
fileUrl = `${repoUrl}/-/blob/${ref}/${filePath}`;
if (lineStart) {
fileUrl += `#L${lineStart}`;
if (lineEnd && lineEnd !== lineStart) {
fileUrl += `-${lineEnd}`;
}
}
return fileUrl;
} else if (hostname === 'bitbucket.org' || hostname.includes('bitbucket')) {
// Bitbucket URL format: https://bitbucket.org/owner/repo/src/commit-hash/path#lines-1:50
fileUrl = `${repoUrl}/src/${ref}/${filePath}`;
if (lineStart) {
fileUrl += `#lines-${lineStart}`;
if (lineEnd && lineEnd !== lineStart) {
fileUrl += `:${lineEnd}`;
}
}
return fileUrl;
}
} catch (error) {
console.warn('Error generating file URL:', error);
}

return '';
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This generateFileUrl function is duplicated from src/app/[owner]/[repo]/page.tsx. To adhere to the DRY (Don't Repeat Yourself) principle, this function should be moved to a shared utility file (e.g., src/utils/generateFileUrl.ts) and imported where needed. This will make maintenance easier and prevent inconsistencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants