diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..882ebd79 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,45 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +# Describe the bug +A clear and concise description of what the bug is. + +# Expected behavior +A clear and concise description of what you expected to happen. + +# How does this bug make you feel? +_Share a gif from [giphy](https://giphy.com/) to tells us how you'd feel_ + +--- + +# Debugging information + +## Steps to reproduce +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +## Screenshots +If applicable, add screenshots to help explain your problem. + +## Logs + +If applicable, add logs to help the engineer debug the problem. + +--- + +# Tasks + +_To be filled in by the engineer picking up the issue_ + +- [ ] Task 1 +- [ ] Task 2 +- [ ] ... diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..3496fc82 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,32 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +# Motivation + +A clear and concise description of why this feature would be useful and the value it would bring. +Explain any alternatives considered and why they are not sufficient. + +# How would you feel if this feature request was implemented? + +_Share a gif from [giphy](https://giphy.com/) to tells us how you'd feel. Format: ![alt_text](https://media.giphy.com/media/xxx/giphy.gif)_ + +# Requirements + +A list of requirements to consider this feature delivered +- Requirement 1 +- Requirement 2 +- ... + +# Tasks + +_To be filled in by the engineer picking up the issue_ + +- [ ] Task 1 +- [ ] Task 2 +- [ ] ... diff --git a/.github/ISSUE_TEMPLATE/subtask.md b/.github/ISSUE_TEMPLATE/subtask.md new file mode 100644 index 00000000..9f86c843 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/subtask.md @@ -0,0 +1,22 @@ +--- +name: Sub task +about: A sub task +title: '' +labels: subtask +assignees: '' + +--- + +Required by + +# Description + +A clear and concise description of what this subtask is. + +# Tasks + +_To be filled in by the engineer picking up the subtask + +- [ ] Task 1 +- [ ] Task 2 +- [ ] ... diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..8cc23880 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,38 @@ +## Purpose + +* ... + +## Does this introduce a breaking change? + + +- [ ] Yes +- [ ] No + + + +## Golden Path Validation +- [ ] I have tested the primary workflows (the "golden path") to ensure they function correctly without errors. + +## Deployment Validation +- [ ] I have validated the deployment process successfully and all services are running as expected with this change. + +## What to Check +Verify that the following are valid +* ... + +## Other Information + + diff --git a/.github/workflows/pr-title-checker.yml b/.github/workflows/pr-title-checker.yml new file mode 100644 index 00000000..debfc53f --- /dev/null +++ b/.github/workflows/pr-title-checker.yml @@ -0,0 +1,22 @@ +name: "PR Title Checker" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + merge_group: + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + if: ${{ github.event_name != 'merge_group' }} + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/content-gen/src/app/frontend/src/App.tsx b/content-gen/src/app/frontend/src/App.tsx index a0556a17..fd1de0de 100644 --- a/content-gen/src/app/frontend/src/App.tsx +++ b/content-gen/src/app/frontend/src/App.tsx @@ -17,17 +17,11 @@ import { ChatHistory } from './components/ChatHistory'; import type { ChatMessage, CreativeBrief, Product, GeneratedContent } from './types'; import ContosoLogo from './styles/images/contoso.svg'; -interface UserInfo { - user_principal_id: string; - user_name: string; - auth_provider: string; - is_authenticated: boolean; -} - function App() { const [conversationId, setConversationId] = useState(() => uuidv4()); const [userId, setUserId] = useState(''); + const [userName, setUserName] = useState(''); const [messages, setMessages] = useState([]); const [isLoading, setIsLoading] = useState(false); const [generationStatus, setGenerationStatus] = useState(''); @@ -72,18 +66,32 @@ function App() { fetchConfig(); }, []); - // Fetch current user on mount + // Fetch current user on mount - using /.auth/me (Azure App Service built-in auth endpoint) useEffect(() => { const fetchUser = async () => { try { - const response = await fetch('/api/user'); + const response = await fetch('/.auth/me'); if (response.ok) { - const user: UserInfo = await response.json(); - setUserId(user.user_principal_id || 'anonymous'); + const payload = await response.json(); + + // Extract user ID from objectidentifier claim + const userClaims = payload[0]?.user_claims || []; + const objectIdClaim = userClaims.find( + (claim: { typ: string; val: string }) => + claim.typ === 'http://schemas.microsoft.com/identity/claims/objectidentifier' + ); + setUserId(objectIdClaim?.val || 'anonymous'); + + // Extract display name from 'name' claim + const nameClaim = userClaims.find( + (claim: { typ: string; val: string }) => claim.typ === 'name' + ); + setUserName(nameClaim?.val || ''); } } catch (err) { console.error('Error fetching user:', err); setUserId('anonymous'); + setUserName(''); } }; fetchUser(); @@ -725,17 +733,6 @@ function App() { } }, [confirmedBrief, selectedProducts, conversationId]); - // Get user initials for avatar - const getUserInitials = () => { - if (!userId) return 'U'; - // If we have a name, use first letter of first and last name - const parts = userId.split('@')[0].split('.'); - if (parts.length >= 2) { - return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); - } - return userId[0].toUpperCase(); - }; - return (
{/* Header */} @@ -764,8 +761,7 @@ function App() { /> diff --git a/content-gen/src/backend/app.py b/content-gen/src/backend/app.py index aecdf7f8..3fe4ffc6 100644 --- a/content-gen/src/backend/app.py +++ b/content-gen/src/backend/app.py @@ -76,19 +76,6 @@ async def health_check(): }) -# ==================== User Info Endpoint ==================== - -@app.route("/api/user", methods=["GET"]) -async def get_current_user(): - """ - Get the current authenticated user info. - - Returns user details from EasyAuth headers, or empty values if not authenticated. - """ - user = get_authenticated_user() - return jsonify(user) - - # ==================== Chat Endpoints ==================== @app.route("/api/chat", methods=["POST"])