Skip to content

Commit b0a202e

Browse files
committed
Add ACI deployment config and limit chat history to 5 conversations with pagination
- Add aci-deployment.yaml with private endpoint configuration (secret removed) - Update ChatHistory component to show only 5 conversations initially - Add 'Show More' and 'Show Less' pagination controls - Rebuild frontend static assets
1 parent 375aaf7 commit b0a202e

4 files changed

Lines changed: 109 additions & 14 deletions

File tree

content-gen/aci-deployment.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: 2021-10-01
2+
name: aci-contentgen-backend
3+
location: eastus
4+
identity:
5+
type: SystemAssigned
6+
properties:
7+
containers:
8+
- name: contentgen-backend
9+
properties:
10+
image: acrcontentgenjh.azurecr.io/contentgen-backend:latest
11+
resources:
12+
requests:
13+
cpu: 1.0
14+
memoryInGB: 2.0
15+
ports:
16+
- port: 8000
17+
protocol: TCP
18+
environmentVariables:
19+
- name: AZURE_OPENAI_ENDPOINT
20+
value: https://ai-account-254ly3n5ky7vw.cognitiveservices.azure.com/
21+
- name: AZURE_OPENAI_GPT_MODEL
22+
value: Gpt-5.1
23+
- name: AZURE_OPENAI_API_VERSION
24+
value: '2024-10-21'
25+
- name: AZURE_OPENAI_DALLE_ENDPOINT
26+
value: https://aicu-cps-ayvergaiq5f2.cognitiveservices.azure.com/
27+
- name: AZURE_OPENAI_DALLE_MODEL
28+
value: dall-e-3
29+
- name: AZURE_COSMOS_ENDPOINT
30+
value: https://cosmosdb-contentgen-jh.documents.azure.com:443/
31+
- name: AZURE_COSMOS_DATABASE_NAME
32+
value: content-generation
33+
- name: AZURE_COSMOS_PRODUCTS_CONTAINER
34+
value: products
35+
- name: AZURE_COSMOS_CONVERSATIONS_CONTAINER
36+
value: conversations
37+
- name: AZURE_BLOB_ACCOUNT_NAME
38+
value: storagecontentgenjh
39+
- name: RUNNING_IN_PRODUCTION
40+
value: 'true'
41+
- name: AUTH_ENABLED
42+
value: 'true'
43+
osType: Linux
44+
subnetIds:
45+
- id: /subscriptions/ff9b5430-90ea-44c0-8a00-e488c1bf56f4/resourceGroups/rg-contentgen-jahunte/providers/Microsoft.Network/virtualNetworks/vnet-contentgen-jh/subnets/subnet-aci
46+
dnsConfig:
47+
nameServers:
48+
- 168.63.129.16
49+
ipAddress:
50+
type: Private
51+
ports:
52+
- protocol: TCP
53+
port: 8000
54+
imageRegistryCredentials:
55+
- server: acrcontentgenjh.azurecr.io
56+
username: acrcontentgenjh
57+
password: <ACR_PASSWORD> # Replace with actual password or use managed identity

content-gen/src/frontend/src/components/ChatHistory.tsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export function ChatHistory({
5050
const [conversations, setConversations] = useState<ConversationSummary[]>([]);
5151
const [isLoading, setIsLoading] = useState(true);
5252
const [error, setError] = useState<string | null>(null);
53+
const [visibleCount, setVisibleCount] = useState(5);
54+
const PAGE_SIZE = 5;
5355

5456
const loadConversations = useCallback(async () => {
5557
setIsLoading(true);
@@ -76,6 +78,11 @@ export function ChatHistory({
7678
loadConversations();
7779
}, [loadConversations, refreshTrigger]);
7880

81+
// Reset visible count when conversations change significantly
82+
useEffect(() => {
83+
setVisibleCount(PAGE_SIZE);
84+
}, [refreshTrigger]);
85+
7986
// Build the current session conversation summary if it has messages
8087
const currentSessionConversation: ConversationSummary | null = currentMessages.length > 0 ? {
8188
id: currentConversationId,
@@ -221,7 +228,7 @@ export function ChatHistory({
221228
</div>
222229
) : (
223230
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
224-
{displayConversations.map((conversation) => (
231+
{displayConversations.slice(0, visibleCount).map((conversation) => (
225232
<ConversationItem
226233
key={conversation.id}
227234
conversation={conversation}
@@ -232,6 +239,37 @@ export function ChatHistory({
232239
truncateText={truncateText}
233240
/>
234241
))}
242+
243+
{/* Show More / Show Less controls */}
244+
{displayConversations.length > PAGE_SIZE && (
245+
<div style={{
246+
display: 'flex',
247+
justifyContent: 'center',
248+
gap: '16px',
249+
marginTop: '8px',
250+
paddingTop: '8px',
251+
borderTop: `1px solid ${tokens.colorNeutralStroke2}`
252+
}}>
253+
{visibleCount < displayConversations.length && (
254+
<Button
255+
appearance="subtle"
256+
size="small"
257+
onClick={() => setVisibleCount(prev => Math.min(prev + PAGE_SIZE, displayConversations.length))}
258+
>
259+
Show More ({displayConversations.length - visibleCount} remaining)
260+
</Button>
261+
)}
262+
{visibleCount > PAGE_SIZE && (
263+
<Button
264+
appearance="subtle"
265+
size="small"
266+
onClick={() => setVisibleCount(PAGE_SIZE)}
267+
>
268+
Show Less
269+
</Button>
270+
)}
271+
</div>
272+
)}
235273
</div>
236274
)}
237275
</div>

0 commit comments

Comments
 (0)