Skip to content

Commit 85b2cd2

Browse files
Merge pull request #692 from microsoft/main
chore: merging main to demo
2 parents fa1ac12 + 3276729 commit 85b2cd2

7 files changed

Lines changed: 179 additions & 37 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
# Describe the bug
11+
A clear and concise description of what the bug is.
12+
13+
# Expected behavior
14+
A clear and concise description of what you expected to happen.
15+
16+
# How does this bug make you feel?
17+
_Share a gif from [giphy](https://giphy.com/) to tells us how you'd feel_
18+
19+
---
20+
21+
# Debugging information
22+
23+
## Steps to reproduce
24+
Steps to reproduce the behavior:
25+
1. Go to '...'
26+
2. Click on '....'
27+
3. Scroll down to '....'
28+
4. See error
29+
30+
## Screenshots
31+
If applicable, add screenshots to help explain your problem.
32+
33+
## Logs
34+
35+
If applicable, add logs to help the engineer debug the problem.
36+
37+
---
38+
39+
# Tasks
40+
41+
_To be filled in by the engineer picking up the issue_
42+
43+
- [ ] Task 1
44+
- [ ] Task 2
45+
- [ ] ...
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
# Motivation
11+
12+
A clear and concise description of why this feature would be useful and the value it would bring.
13+
Explain any alternatives considered and why they are not sufficient.
14+
15+
# How would you feel if this feature request was implemented?
16+
17+
_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)_
18+
19+
# Requirements
20+
21+
A list of requirements to consider this feature delivered
22+
- Requirement 1
23+
- Requirement 2
24+
- ...
25+
26+
# Tasks
27+
28+
_To be filled in by the engineer picking up the issue_
29+
30+
- [ ] Task 1
31+
- [ ] Task 2
32+
- [ ] ...

.github/ISSUE_TEMPLATE/subtask.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Sub task
3+
about: A sub task
4+
title: ''
5+
labels: subtask
6+
assignees: ''
7+
8+
---
9+
10+
Required by <link to parent issue>
11+
12+
# Description
13+
14+
A clear and concise description of what this subtask is.
15+
16+
# Tasks
17+
18+
_To be filled in by the engineer picking up the subtask
19+
20+
- [ ] Task 1
21+
- [ ] Task 2
22+
- [ ] ...

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Purpose
2+
<!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? -->
3+
* ...
4+
5+
## Does this introduce a breaking change?
6+
<!-- Mark one with an "x". -->
7+
8+
- [ ] Yes
9+
- [ ] No
10+
11+
<!-- Please prefix your PR title with one of the following:
12+
* `feat`: A new feature
13+
* `fix`: A bug fix
14+
* `docs`: Documentation only changes
15+
* `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
16+
* `refactor`: A code change that neither fixes a bug nor adds a feature
17+
* `perf`: A code change that improves performance
18+
* `test`: Adding missing tests or correcting existing tests
19+
* `build`: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
20+
* `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
21+
* `chore`: Other changes that don't modify src or test files
22+
* `revert`: Reverts a previous commit
23+
* !: A breaking change is indicated with a `!` after the listed prefixes above, e.g. `feat!`, `fix!`, `refactor!`, etc.
24+
-->
25+
26+
## Golden Path Validation
27+
- [ ] I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.
28+
29+
## Deployment Validation
30+
- [ ] I have validated the deployment process successfully and all services are running as expected with this change.
31+
32+
## What to Check
33+
Verify that the following are valid
34+
* ...
35+
36+
## Other Information
37+
38+
<!-- Add any other helpful information that may be needed here. -->
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "PR Title Checker"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
merge_group:
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
main:
16+
name: Validate PR title
17+
runs-on: ubuntu-latest
18+
if: ${{ github.event_name != 'merge_group' }}
19+
steps:
20+
- uses: amannn/action-semantic-pull-request@v5
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

content-gen/src/app/frontend/src/App.tsx

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,11 @@ import { ChatHistory } from './components/ChatHistory';
1717
import type { ChatMessage, CreativeBrief, Product, GeneratedContent } from './types';
1818
import ContosoLogo from './styles/images/contoso.svg';
1919

20-
interface UserInfo {
21-
user_principal_id: string;
22-
user_name: string;
23-
auth_provider: string;
24-
is_authenticated: boolean;
25-
}
26-
2720

2821
function App() {
2922
const [conversationId, setConversationId] = useState<string>(() => uuidv4());
3023
const [userId, setUserId] = useState<string>('');
24+
const [userName, setUserName] = useState<string>('');
3125
const [messages, setMessages] = useState<ChatMessage[]>([]);
3226
const [isLoading, setIsLoading] = useState(false);
3327
const [generationStatus, setGenerationStatus] = useState<string>('');
@@ -72,18 +66,32 @@ function App() {
7266
fetchConfig();
7367
}, []);
7468

75-
// Fetch current user on mount
69+
// Fetch current user on mount - using /.auth/me (Azure App Service built-in auth endpoint)
7670
useEffect(() => {
7771
const fetchUser = async () => {
7872
try {
79-
const response = await fetch('/api/user');
73+
const response = await fetch('/.auth/me');
8074
if (response.ok) {
81-
const user: UserInfo = await response.json();
82-
setUserId(user.user_principal_id || 'anonymous');
75+
const payload = await response.json();
76+
77+
// Extract user ID from objectidentifier claim
78+
const userClaims = payload[0]?.user_claims || [];
79+
const objectIdClaim = userClaims.find(
80+
(claim: { typ: string; val: string }) =>
81+
claim.typ === 'http://schemas.microsoft.com/identity/claims/objectidentifier'
82+
);
83+
setUserId(objectIdClaim?.val || 'anonymous');
84+
85+
// Extract display name from 'name' claim
86+
const nameClaim = userClaims.find(
87+
(claim: { typ: string; val: string }) => claim.typ === 'name'
88+
);
89+
setUserName(nameClaim?.val || '');
8390
}
8491
} catch (err) {
8592
console.error('Error fetching user:', err);
8693
setUserId('anonymous');
94+
setUserName('');
8795
}
8896
};
8997
fetchUser();
@@ -725,17 +733,6 @@ function App() {
725733
}
726734
}, [confirmedBrief, selectedProducts, conversationId]);
727735

728-
// Get user initials for avatar
729-
const getUserInitials = () => {
730-
if (!userId) return 'U';
731-
// If we have a name, use first letter of first and last name
732-
const parts = userId.split('@')[0].split('.');
733-
if (parts.length >= 2) {
734-
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
735-
}
736-
return userId[0].toUpperCase();
737-
};
738-
739736
return (
740737
<div className="app-container">
741738
{/* Header */}
@@ -764,8 +761,7 @@ function App() {
764761
/>
765762
</Tooltip>
766763
<Avatar
767-
name={userId || 'User'}
768-
initials={getUserInitials()}
764+
name={userName || undefined}
769765
color="colorful"
770766
size={36}
771767
/>

content-gen/src/backend/app.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,6 @@ async def health_check():
7676
})
7777

7878

79-
# ==================== User Info Endpoint ====================
80-
81-
@app.route("/api/user", methods=["GET"])
82-
async def get_current_user():
83-
"""
84-
Get the current authenticated user info.
85-
86-
Returns user details from EasyAuth headers, or empty values if not authenticated.
87-
"""
88-
user = get_authenticated_user()
89-
return jsonify(user)
90-
91-
9279
# ==================== Chat Endpoints ====================
9380

9481
@app.route("/api/chat", methods=["POST"])

0 commit comments

Comments
 (0)