Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 17 additions & 23 deletions multimodal/tarko/agent-server-next/src/controllers/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,24 @@ export async function createSession(c: HonoContext) {
*/
export async function getSessionDetails(c: HonoContext) {
const server = c.get('server');
const session = c.get('session');
const sessionId = c.req.query('sessionId');

try {
if (!session) {
return c.json({ error: 'Session not found' }, 404);
if (!sessionId) {
return c.json({ error: 'SessionId not found' }, 404);
}

if (sessionId) {
const sessionInfo = await server.daoFactory.getSessionInfo(sessionId);
const sessionInfo = await server.daoFactory.getSessionInfo(sessionId);

sessionInfo && filterSessionModel([sessionInfo]);
sessionInfo && filterSessionModel([sessionInfo]);

if (sessionInfo) {
return c.json(
{
session: sessionInfo,
},
200,
);
}
if (sessionInfo) {
return c.json(
{
session: sessionInfo,
},
200,
);
}

return c.json({ error: 'Session not found' }, 404);
Expand Down Expand Up @@ -163,7 +160,7 @@ export async function getSessionStatus(c: HonoContext) {
return c.json({ error: 'Session not found' }, 404);
}

const isProcessing = session.getProcessingStatus();
const isProcessing = session.getProcessingStatus();

return c.json(
{
Expand All @@ -186,7 +183,6 @@ export async function getSessionStatus(c: HonoContext) {
*/
export async function updateSession(c: HonoContext) {
const server = c.get('server');
const session = c.get('session');
const body = await c.req.json();

const { sessionId, metadata: metadataUpdates } = body as {
Expand All @@ -195,8 +191,8 @@ export async function updateSession(c: HonoContext) {
};

try {
if (!session) {
return c.json({ error: 'Session not found' }, 404);
if (!sessionId) {
return c.json({ error: 'SessionId not found' }, 404);
}

const sessionInfo = await server.daoFactory.getSessionInfo(sessionId);
Expand All @@ -223,14 +219,12 @@ export async function updateSession(c: HonoContext) {
*/
export async function deleteSession(c: HonoContext) {
const server = c.get('server');
const session = c.get('session');
const sessionId = (await c.req.json())?.sessionId

if (!session) {
return c.json({ error: 'Session not found' }, 404);
if (!sessionId) {
return c.json({ error: 'sessionId not found' }, 404);
}

const sessionId = session.id;

try {
const sessionPool = server.getSessionPool();

Expand Down
5 changes: 0 additions & 5 deletions multimodal/tarko/agent-server-next/src/routes/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ export function createSessionRoutes(): Hono<{ Variables: ContextVariables }> {
router.post('/api/v1/sessions/create', exclusiveModeMiddleware, sessionsController.createSession);

// Routes that require session restore middleware
router.use('/api/v1/sessions/details', sessionRestoreMiddleware);
router.use('/api/v1/sessions/events', sessionRestoreMiddleware);
router.use('/api/v1/sessions/events/*', sessionRestoreMiddleware);
router.use('/api/v1/sessions/status', sessionRestoreMiddleware);
router.use('/api/v1/sessions/update', sessionRestoreMiddleware);
router.use('/api/v1/sessions/delete', sessionRestoreMiddleware);
router.use('/api/v1/sessions/generate-summary', sessionRestoreMiddleware);
router.use('/api/v1/sessions/share', sessionRestoreMiddleware);
router.use('/api/v1/sessions/workspace/*', sessionRestoreMiddleware);
Expand Down
Loading