fix: Replace getSessionHistory with getSession API call

The API was updated and getSessionHistory no longer exists.
Updated all imports and calls to use getSession instead.
Also updated response field from sessionId to session_id to match new API.
This commit is contained in:
spencrmartin
2025-12-03 15:15:21 -05:00
parent 2bc492d7d9
commit a0e5ae8a28
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useId, useReducer, useRef, useState } from 'react';
import useSWR from 'swr';
import { createUserMessage, hasCompletedToolCalls, Message } from '../types/message';
import { getSessionHistory } from '../api';
import { getSession } from '../api';
import { ChatState } from '../types/chatState';
let messageIdCounter = 0;
@@ -396,7 +396,7 @@ export function useMessageStream({
?.session_id as string;
if (sessionId) {
try {
const sessionResponse = await getSessionHistory({
const sessionResponse = await getSession({
path: { session_id: sessionId },
});
+4 -4
View File
@@ -1,5 +1,5 @@
import { Message } from './types/message';
import { getSessionHistory, listSessions, SessionInfo } from './api';
import { getSession, listSessions, SessionInfo } from './api';
import { convertApiMessageToFrontendMessage } from './components/context_management';
import { getApiUrl } from './config';
@@ -138,13 +138,13 @@ export async function fetchSessions(): Promise<Session[]> {
*/
export async function fetchSessionDetails(sessionId: string): Promise<SessionDetails> {
try {
const response = await getSessionHistory<true>({
const response = await getSession<true>({
path: { session_id: sessionId },
});
// Convert the SessionHistoryResponse to a SessionDetails object
// Convert the SessionResponse to a SessionDetails object
return {
session_id: response.data.sessionId,
session_id: response.data.session_id,
metadata: ensureWorkingDir(response.data.metadata),
messages: response.data.messages.map((message) =>
convertApiMessageToFrontendMessage(message, true, true)