11/**
22 * AgentChat Component
33 *
4- * Chat interface for Azure OpenAI LangGraph Agent
5- * Agent has access to task tools and ticket MCP tools
4+ * Chat interface for OpenAI LangGraph Agent
5+ * Agent has access to CSV ticket tools
66 *
77 * Following principles:
88 * - Pure functions for message formatting (calculations)
@@ -31,6 +31,8 @@ import {
3131 Wrench20Regular ,
3232} from '@fluentui/react-icons'
3333import { useEffect , useRef , useState } from 'react'
34+ import ReactMarkdown from 'react-markdown'
35+ import remarkGfm from 'remark-gfm'
3436import { agentChat } from '../../services/api'
3537
3638const useStyles = makeStyles ( {
@@ -105,6 +107,46 @@ const useStyles = makeStyles({
105107 wordBreak : 'break-word' ,
106108 whiteSpace : 'pre-wrap' ,
107109 } ,
110+ messageContentMarkdown : {
111+ whiteSpace : 'normal' ,
112+ lineHeight : 1.5 ,
113+ } ,
114+ markdown : {
115+ '& h1, & h2, & h3' : {
116+ margin : `${ tokens . spacingVerticalS } 0 ${ tokens . spacingVerticalXS } ` ,
117+ fontWeight : tokens . fontWeightSemibold ,
118+ } ,
119+ '& ul, & ol' : {
120+ paddingLeft : tokens . spacingHorizontalL ,
121+ margin : `${ tokens . spacingVerticalXS } 0` ,
122+ } ,
123+ '& table' : {
124+ width : '100%' ,
125+ borderCollapse : 'collapse' ,
126+ marginTop : tokens . spacingVerticalXS ,
127+ } ,
128+ '& th, & td' : {
129+ border : `1px solid ${ tokens . colorNeutralStroke1 } ` ,
130+ padding : tokens . spacingHorizontalXS ,
131+ textAlign : 'left' ,
132+ } ,
133+ '& pre' : {
134+ backgroundColor : tokens . colorNeutralBackground3 ,
135+ padding : tokens . spacingHorizontalM ,
136+ borderRadius : tokens . borderRadiusSmall ,
137+ overflowX : 'auto' ,
138+ } ,
139+ '& code' : {
140+ fontFamily : 'monospace' ,
141+ backgroundColor : tokens . colorNeutralBackground3 ,
142+ padding : '0 4px' ,
143+ borderRadius : tokens . borderRadiusSmall ,
144+ } ,
145+ '& a' : {
146+ color : tokens . colorBrandForegroundLink ,
147+ textDecoration : 'underline' ,
148+ } ,
149+ } ,
108150 userContent : {
109151 backgroundColor : tokens . colorBrandBackground2 ,
110152 } ,
@@ -230,7 +272,7 @@ export default function AgentChat() {
230272 < Text weight = "semibold" size = { 500 } >
231273 AI Agent
232274 </ Text >
233- < Badge color = "informative" appearance = "filled" > Azure OpenAI</ Badge >
275+ < Badge color = "informative" appearance = "filled" > OpenAI</ Badge >
234276 </ div >
235277 < div className = { styles . headerControls } >
236278 < Text size = { 200 } > Powered by LangGraph + GPT</ Text >
@@ -252,12 +294,12 @@ export default function AgentChat() {
252294 { messages . length === 0 && ! error && (
253295 < div className = { styles . emptyState } >
254296 < Bot24Regular style = { { fontSize : '48px' , marginBottom : tokens . spacingVerticalM } } />
255- < Text size = { 400 } > Start a conversation with the AI Agent </ Text >
297+ < Text size = { 400 } > Starte eine Unterhaltung mit dem AI Agenten </ Text >
256298 < Text size = { 300 } style = { { marginTop : tokens . spacingVerticalS , display : 'block' } } >
257- The agent can manage tasks and tickets for you!
299+ Der Agent kann Tickets durchsuchen und Details anzeigen.
258300 </ Text >
259301 < Text size = { 200 } style = { { marginTop : tokens . spacingVerticalM , display : 'block' } } >
260- Try : "Create a task to review the documentation" or "List all tasks "
302+ Versuche : "Suche Tickets mit 'VPN'" oder "Zeige Ticket [Ticket-ID] "
261303 </ Text >
262304 </ div >
263305 ) }
@@ -285,9 +327,15 @@ export default function AgentChat() {
285327 < div
286328 className = { `${ styles . messageContent } ${
287329 message . role === 'user' ? styles . userContent : styles . assistantContent
288- } `}
330+ } ${ message . role !== 'user' ? styles . messageContentMarkdown : '' } `}
289331 >
290- < Text > { message . content } </ Text >
332+ { message . role === 'user' ? (
333+ < Text style = { { whiteSpace : 'pre-wrap' } } > { message . content } </ Text >
334+ ) : (
335+ < div className = { styles . markdown } >
336+ < ReactMarkdown remarkPlugins = { [ remarkGfm ] } > { message . content } </ ReactMarkdown >
337+ </ div >
338+ ) }
291339 { message . error && (
292340 < div className = { styles . errorDetails } >
293341 < Text weight = "semibold" size = { 200 } style = { { color : tokens . colorPaletteRedForeground1 } } >
0 commit comments