start prompt comes from back-end

This commit is contained in:
Steve Androulakis
2025-02-03 13:32:33 -08:00
parent 2a2383bb71
commit 36d4bd5889
7 changed files with 64 additions and 18 deletions

View File

@@ -167,7 +167,7 @@ export default function App() {
try {
setError(INITIAL_ERROR_STATE);
setLoading(true);
await apiService.sendMessage("I'd like to travel for an event.");
await apiService.startWorkflow();
setConversation([]);
setLastMessage(null);
} catch (err) {

View File

@@ -56,6 +56,26 @@ export const apiService = {
}
},
async startWorkflow() {
try {
const res = await fetch(
`${API_BASE_URL}/start-workflow`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
}
);
return handleResponse(res);
} catch (error) {
throw new ApiError(
'Failed to start workflow',
error.status || 500
);
}
},
async confirm() {
try {
const res = await fetch(`${API_BASE_URL}/confirm`, {