Skip to content

Dev to qa#86

Merged
fpittelo merged 14 commits intoqafrom
dev
Nov 24, 2025
Merged

Dev to qa#86
fpittelo merged 14 commits intoqafrom
dev

Conversation

@fpittelo
Copy link
Owner

Dev to qa

Copilot AI and others added 14 commits November 23, 2025 15:43
- Updated HomePage.js to call Function App API instead of returning placeholder
- Changed Function App auth level from FUNCTION to ANONYMOUS (frontend auth via Google OAuth)
- Added REACT_APP_FUNCTION_APP_URL environment variable support
- Updated deployment workflow to inject Function App URL during build
- Added .env.example with configuration documentation
- Updated frontend README with environment variable documentation

Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
- Removed unnecessary placeholder filter in conversation history
- Sanitized error logging to avoid exposing sensitive information

Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Connect chat box to Azure OpenAI via Function App API
…ion App

Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Fix Azure Function App 404 by enabling remote build for Python dependencies
Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Fix Azure Functions remote build by setting deployment flags in workflows
Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
…yment

Fix Azure Functions deployment: use string values for build parameters
@gemini-code-assist
Copy link

Summary of Changes

Hello @fpittelo, 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 establishes the core integration between the frontend chat application and the backend Azure Function App. It enables the frontend to communicate with the backend API for chat responses, configures the necessary environment variables for this connection, and adjusts the backend's authentication to facilitate this interaction. Additionally, it updates the infrastructure settings to support the build and deployment of the function app.

Highlights

  • Backend API Authentication: The chat endpoint in backend/function_app.py has been updated to use auth_level=func.AuthLevel.ANONYMOUS, allowing unauthenticated access to the chat API.
  • Frontend API Integration: The HomePage.js component in the frontend now directly calls the Azure Function App's chat API instead of using a simulated response. It fetches the API URL from the REACT_APP_FUNCTION_APP_URL environment variable and includes conversation history in the request.
  • Environment Variable Configuration: A new .env.example file has been added to the frontend, and the README.md has been updated to document the REACT_APP_FUNCTION_APP_URL environment variable, which is crucial for connecting the frontend to the backend API.
  • Infrastructure Build Settings: The Terraform configuration for the Azure Function App (modules/function_app/main.tf) now includes SCM_DO_BUILD_DURING_DEPLOYMENT and ENABLE_ORYX_BUILD settings to ensure proper build processes during deployment.
Ignored Files
  • Ignored by pattern: .github/workflows/** (5)
    • .github/workflows/deploy-app.yaml
    • .github/workflows/deploy-function.yaml
    • .github/workflows/deploy.yaml
    • .github/workflows/destroy-infra.yaml
    • .github/workflows/destroy.yaml
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.

@fpittelo fpittelo merged commit b0e718f into qa Nov 24, 2025
4 checks passed
@fpittelo fpittelo deleted the dev branch November 24, 2025 14:01
Copy link

@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 integrates the frontend with the backend chat API, replacing the mock bot response with actual API calls. It also updates documentation and Terraform configuration for deployment. My review has identified a critical security vulnerability in the backend function's authentication level. Additionally, there are a couple of medium-severity issues in the frontend related to unique key generation for React components and error logging that could be improved for better robustness and easier debugging.

)

@app.route(route="chat", methods=["POST"], auth_level=func.AuthLevel.FUNCTION)
@app.route(route="chat", methods=["POST"], auth_level=func.AuthLevel.ANONYMOUS)

Choose a reason for hiding this comment

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

critical

Changing the authentication level to ANONYMOUS exposes this function endpoint to the public internet without any authentication. This means anyone can call your chat API, which could lead to significant security risks and unexpected costs from the underlying Azure OpenAI service. The function should be secured. Consider using Azure App Service's built-in authentication (Easy Auth) on the Function App as well, or revert to AuthLevel.FUNCTION and securely provide the function key to the frontend application via its application settings.

Comment on lines 82 to +98
const botMessage = {
id: Date.now() + 1,
type: "bot",
text: "I'm a placeholder response. Integration with Azure OpenAI will be implemented in future tasks.",
text: data.response || "I apologize, but I couldn't generate a response.",
timestamp: new Date(),
};
setMessages((prev) => [...prev, botMessage]);
} catch (error) {
// Log error without sensitive details
console.error("Error calling chat API");
const errorMessage = {
id: Date.now() + 1,
type: "bot",
text: "I apologize, but I'm having trouble connecting to the service. Please try again later.",
timestamp: new Date(),
};
setMessages((prev) => [...prev, errorMessage]);

Choose a reason for hiding this comment

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

medium

Using Date.now() or Date.now() + 1 (lines 83 and 93) to generate unique ids for React components is not a robust approach. It's possible for multiple messages to be created within the same millisecond, which would lead to duplicate keys and cause rendering issues. This also applies to the user message ID created on line 39. A better approach is to use a more reliable source of unique identifiers, such as crypto.randomUUID() or a simple counter stored in a useRef.

setMessages((prev) => [...prev, botMessage]);
} catch (error) {
// Log error without sensitive details
console.error("Error calling chat API");

Choose a reason for hiding this comment

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

medium

The catch block logs a generic error message but doesn't include the actual error object. This makes debugging difficult as the specific reason for the failure (e.g., network error, API error status) is lost. While the comment mentions avoiding sensitive details, the error from fetch or a thrown Error is generally safe to log in development environments and is very useful for debugging.

Suggested change
console.error("Error calling chat API");
console.error("Error calling chat API:", error);

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