Skip to content

Commit 28c67c5

Browse files
committed
added back fields and fixed bugs
1 parent c7ebf6c commit 28c67c5

13 files changed

Lines changed: 378 additions & 753 deletions

content-gen/CONTENT_GENERATION_UI_IMPROVEMENT_PLAN.md

Lines changed: 0 additions & 282 deletions
This file was deleted.

content-gen/src/backend/app.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ def get_authenticated_user():
4949
Get the authenticated user from EasyAuth headers.
5050
5151
In production (with App Service Auth), the X-Ms-Client-Principal-Id header
52-
contains the user's ID. In development mode, returns empty/None values.
52+
contains the user's ID. In development mode, returns "anonymous".
5353
"""
5454
user_principal_id = request.headers.get("X-Ms-Client-Principal-Id", "")
5555
user_name = request.headers.get("X-Ms-Client-Principal-Name", "")
5656
auth_provider = request.headers.get("X-Ms-Client-Principal-Idp", "")
5757

5858
return {
59-
"user_principal_id": user_principal_id or "",
59+
"user_principal_id": user_principal_id or "anonymous",
6060
"user_name": user_name or "",
6161
"auth_provider": auth_provider or "",
6262
"is_authenticated": bool(user_principal_id)
@@ -1051,14 +1051,13 @@ async def list_conversations():
10511051
List conversations for a user.
10521052
10531053
Uses authenticated user from EasyAuth headers. In development mode
1054-
(when not authenticated), returns conversations where user_id is empty/null.
1054+
(when not authenticated), uses "anonymous" as user_id.
10551055
10561056
Query params:
10571057
limit: Max number of results (default 20)
10581058
"""
1059-
# Get authenticated user from headers
10601059
auth_user = get_authenticated_user()
1061-
user_id = auth_user["user_principal_id"] # Empty string if not authenticated
1060+
user_id = auth_user["user_principal_id"]
10621061

10631062
limit = int(request.args.get("limit", 20))
10641063

content-gen/src/backend/services/cosmos_service.py

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -431,39 +431,24 @@ async def get_user_conversations(
431431
Get all conversations for a user with summary data.
432432
433433
Args:
434-
user_id: User ID (empty string for development mode - returns conversations with empty/null user_id)
434+
user_id: User ID ("anonymous" for unauthenticated users)
435435
limit: Maximum number of conversations
436436
437437
Returns:
438438
List of conversation summaries
439439
"""
440440
await self.initialize()
441441

442-
# Get conversations with messages to extract title and last message
443-
# In development mode (empty user_id), get conversations where user_id is empty, null, or not set
444-
if user_id:
445-
# Production mode: get conversations for the authenticated user
446-
query = """
447-
SELECT TOP @limit c.id, c.user_id, c.updated_at, c.messages, c.brief
448-
FROM c
449-
WHERE c.user_id = @user_id
450-
ORDER BY c.updated_at DESC
451-
"""
452-
params = [
453-
{"name": "@user_id", "value": user_id},
454-
{"name": "@limit", "value": limit}
455-
]
456-
else:
457-
# Development mode: get conversations where user_id is empty, null, or not defined
458-
query = """
459-
SELECT TOP @limit c.id, c.user_id, c.updated_at, c.messages, c.brief
460-
FROM c
461-
WHERE (NOT IS_DEFINED(c.user_id) OR c.user_id = null OR c.user_id = "")
462-
ORDER BY c.updated_at DESC
463-
"""
464-
params = [
465-
{"name": "@limit", "value": limit}
466-
]
442+
query = """
443+
SELECT TOP @limit c.id, c.user_id, c.updated_at, c.messages, c.brief
444+
FROM c
445+
WHERE c.user_id = @user_id
446+
ORDER BY c.updated_at DESC
447+
"""
448+
params = [
449+
{"name": "@user_id", "value": user_id},
450+
{"name": "@limit", "value": limit}
451+
]
467452

468453
conversations = []
469454
async for item in self._conversations_container.query_items(

content-gen/src/frontend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
5+
<link rel="icon" type="image/svg+xml" href="/microsoft.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Content Generation Accelerator</title>
88
</head>
Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)