feat: support thinking status

This commit is contained in:
Steve Korshakov 2025-07-13 21:33:38 -07:00
parent 751f306531
commit bff8fdef77
3 changed files with 9 additions and 6 deletions

View File

@ -380,7 +380,7 @@ export async function startApi() {
}
};
pubsub.on('update', updateHandler);
const updateEphemeralHandler = (accountId: string, update: { type: 'activity', id: string, active: boolean, activeAt: number }) => {
const updateEphemeralHandler = (accountId: string, update: { type: 'activity', id: string, active: boolean, activeAt: number, thinking: boolean }) => {
if (accountId === userId) {
socket.emit('ephemeral', {
type: update.type,
@ -407,7 +407,7 @@ export async function startApi() {
});
socket.on('session-alive', async (data: any) => {
const { sid, time } = data;
const { sid, time, thinking } = data;
let t = time;
if (typeof t !== 'number') {
return;
@ -438,7 +438,8 @@ export async function startApi() {
type: 'activity',
id: sid,
active: true,
activeAt: t
activeAt: t,
thinking
});
});
@ -474,7 +475,8 @@ export async function startApi() {
type: 'activity',
id: sid,
active: false,
activeAt: t
activeAt: t,
thinking: false
});
});

View File

@ -24,7 +24,8 @@ export function startTimeout() {
type: 'activity',
id: session.id,
active: false,
activeAt: session.lastActiveAt.getTime()
activeAt: session.lastActiveAt.getTime(),
thinking: false
});
}

View File

@ -3,7 +3,7 @@ import { Update } from '@prisma/client';
export interface PubSubEvents {
'update': (accountId: string, update: Update) => void;
'update-ephemeral': (accountId: string, update: { type: 'activity', id: string, active: boolean, activeAt: number }) => void;
'update-ephemeral': (accountId: string, update: { type: 'activity', id: string, active: boolean, activeAt: number, thinking: boolean }) => void;
}
class PubSubService extends EventEmitter {