Co-authored-by: paisley <8197966+su8su@users.noreply.github.com> Co-authored-by: zuolingxuan <zuolingxuan@bytedance.com>
17 lines
545 B
TypeScript
17 lines
545 B
TypeScript
import type { ChatGet, ChatSet, RuntimeActions } from './store-api';
|
|
|
|
export function createRuntimeUiActions(set: ChatSet, get: ChatGet): Pick<RuntimeActions, 'toggleThinking' | 'refresh' | 'clearError'> {
|
|
return {
|
|
toggleThinking: () => set((s) => ({ showThinking: !s.showThinking })),
|
|
|
|
// ── Refresh: reload history + sessions ──
|
|
|
|
refresh: async () => {
|
|
const { loadHistory, loadSessions } = get();
|
|
await Promise.all([loadHistory(), loadSessions()]);
|
|
},
|
|
|
|
clearError: () => set({ error: null }),
|
|
};
|
|
}
|