Update App.tsx
This commit is contained in:
6
App.tsx
6
App.tsx
@@ -4,7 +4,7 @@ import { ClientPortal } from './components/ClientPortal';
|
||||
import { AuthScreen } from './components/AuthScreen';
|
||||
import { ToastContainer, ToastMessage, ToastType } from './components/Toast';
|
||||
import { INITIAL_SETTINGS } from './constants';
|
||||
import { Agent, AppSettings, AppState, ClientUser, KBArticle, Ticket, TicketStatus, SurveyResult, TicketQueue, ChatMessage, AgentRole } from './types';
|
||||
import { Agent, AppSettings, AppState, ClientUser, KBArticle, Ticket, TicketStatus, SurveyResult, TicketQueue, ChatMessage, AgentRole, Attachment } from './types';
|
||||
|
||||
const App: React.FC = () => {
|
||||
const [state, setState] = useState<AppState>({
|
||||
@@ -147,12 +147,12 @@ const App: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const replyToTicket = async (ticketId: string, message: string) => {
|
||||
const replyToTicket = async (ticketId: string, message: string, attachments: Attachment[] = []) => {
|
||||
const role = state.userRole === 'client' ? 'user' : 'assistant';
|
||||
try {
|
||||
const newMsg = await apiFetch(`/tickets/${ticketId}/messages`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ role, content: message })
|
||||
body: JSON.stringify({ role, content: message, attachments })
|
||||
});
|
||||
|
||||
setState(prev => ({
|
||||
|
||||
Reference in New Issue
Block a user