mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
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:
@@ -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 },
|
||||
});
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user