Show reasoning output automatically when enabled (#1943)
* feat(app): add auto-expand reasoning setting * chore: add cross-env mise tool * fix(app): stabilize web export and settings detail placement * Revert "chore: add cross-env mise tool" This reverts commit f56a367e0cd6766140db2d3b30a1c57bff4d9a14. * perf(app): narrow settings reads in agent stream --------- Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
co-authored by
Mohamed Boudra
parent
29a3261dd6
commit
d96d599466
@@ -96,6 +96,8 @@ export interface UseSettingsReturn {
|
||||
resetSettings: () => Promise<void>;
|
||||
}
|
||||
|
||||
type SettingsSelector<TSelected> = (settings: Settings) => TSelected;
|
||||
|
||||
export function useAppSettings(): UseAppSettingsReturn {
|
||||
const queryClient = useQueryClient();
|
||||
const { data, isPending, error } = useQuery({
|
||||
@@ -137,7 +139,11 @@ export function useAppSettings(): UseAppSettingsReturn {
|
||||
};
|
||||
}
|
||||
|
||||
export function useSettings(): UseSettingsReturn {
|
||||
export function useSettings(): UseSettingsReturn;
|
||||
export function useSettings<TSelected>(selector: SettingsSelector<TSelected>): TSelected;
|
||||
export function useSettings<TSelected>(
|
||||
selector?: SettingsSelector<TSelected>,
|
||||
): UseSettingsReturn | TSelected {
|
||||
const appSettings = useAppSettings();
|
||||
const desktopSettings = useDesktopSettings();
|
||||
|
||||
@@ -177,6 +183,9 @@ export function useSettings(): UseSettingsReturn {
|
||||
if (updates.workspaceTitleSource !== undefined) {
|
||||
appUpdates.workspaceTitleSource = updates.workspaceTitleSource;
|
||||
}
|
||||
if (updates.autoExpandReasoning !== undefined) {
|
||||
appUpdates.autoExpandReasoning = updates.autoExpandReasoning;
|
||||
}
|
||||
const promises: Promise<void>[] = [];
|
||||
if (Object.keys(appUpdates).length > 0) {
|
||||
promises.push(appSettings.updateSettings(appUpdates));
|
||||
@@ -210,13 +219,19 @@ export function useSettings(): UseSettingsReturn {
|
||||
await Promise.all(resets);
|
||||
}, [appSettings, desktopSettings]);
|
||||
|
||||
const settings = {
|
||||
...DEFAULT_APP_SETTINGS,
|
||||
...appSettings.settings,
|
||||
manageBuiltInDaemon: desktopSettings.settings.daemon.manageBuiltInDaemon,
|
||||
releaseChannel: desktopSettings.settings.releaseChannel,
|
||||
};
|
||||
|
||||
if (selector) {
|
||||
return selector(settings);
|
||||
}
|
||||
|
||||
return {
|
||||
settings: {
|
||||
...DEFAULT_APP_SETTINGS,
|
||||
...appSettings.settings,
|
||||
manageBuiltInDaemon: desktopSettings.settings.daemon.manageBuiltInDaemon,
|
||||
releaseChannel: desktopSettings.settings.releaseChannel,
|
||||
},
|
||||
settings,
|
||||
isLoading: appSettings.isLoading || desktopSettings.isLoading,
|
||||
error: appSettings.error ?? desktopSettings.error,
|
||||
updateSettings,
|
||||
|
||||
Reference in New Issue
Block a user