feat: support thinking status
This commit is contained in:
parent
751f306531
commit
bff8fdef77
@ -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
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -24,7 +24,8 @@ export function startTimeout() {
|
||||
type: 'activity',
|
||||
id: session.id,
|
||||
active: false,
|
||||
activeAt: session.lastActiveAt.getTime()
|
||||
activeAt: session.lastActiveAt.getTime(),
|
||||
thinking: false
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user