chore: clean up ui as we don't have session based permission setting on ui (#9975)
This commit is contained in:
+3
-16
@@ -183,7 +183,7 @@ const PairRouteWrapper = ({
|
||||
return null;
|
||||
};
|
||||
|
||||
const SettingsRoute = ({ activeSessionId }: { activeSessionId?: string }) => {
|
||||
const SettingsRoute = () => {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const [searchParams] = useSearchParams();
|
||||
@@ -199,13 +199,7 @@ const SettingsRoute = ({ activeSessionId }: { activeSessionId?: string }) => {
|
||||
viewOptions.section = sectionFromUrl;
|
||||
}
|
||||
|
||||
return (
|
||||
<SettingsView
|
||||
onClose={() => navigate('/')}
|
||||
setView={setView}
|
||||
viewOptions={{ ...viewOptions, sessionId: activeSessionId }}
|
||||
/>
|
||||
);
|
||||
return <SettingsView onClose={() => navigate('/')} setView={setView} viewOptions={viewOptions} />;
|
||||
};
|
||||
|
||||
const SessionsRoute = () => {
|
||||
@@ -684,14 +678,7 @@ export function AppInner() {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="settings"
|
||||
element={
|
||||
<SettingsRoute
|
||||
activeSessionId={activeSessions[activeSessions.length - 1]?.sessionId}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route path="settings" element={<SettingsRoute />} />
|
||||
<Route
|
||||
path="extensions"
|
||||
element={
|
||||
|
||||
@@ -74,7 +74,6 @@ export type SettingsViewOptions = {
|
||||
deepLinkConfig?: ExtensionConfig;
|
||||
showEnvVars?: boolean;
|
||||
section?: string;
|
||||
sessionId?: string;
|
||||
};
|
||||
|
||||
export default function SettingsView({
|
||||
@@ -260,7 +259,7 @@ export default function SettingsView({
|
||||
value="chat"
|
||||
className="mt-0 focus-visible:outline-none focus-visible:ring-0"
|
||||
>
|
||||
<ChatSettingsSection sessionId={viewOptions.sessionId} />
|
||||
<ChatSettingsSection />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent
|
||||
|
||||
@@ -10,11 +10,12 @@ import { defineMessages, useIntl } from '../../../i18n';
|
||||
const i18n = defineMessages({
|
||||
modeTitle: {
|
||||
id: 'chatSettings.modeTitle',
|
||||
defaultMessage: 'Mode',
|
||||
defaultMessage: 'Default Mode',
|
||||
},
|
||||
modeDescription: {
|
||||
id: 'chatSettings.modeDescription',
|
||||
defaultMessage: 'Configure how Goose interacts with tools and extensions',
|
||||
defaultMessage:
|
||||
'Choose the default mode Goose uses for new sessions. Existing sessions keep their current mode.',
|
||||
},
|
||||
responseStylesTitle: {
|
||||
id: 'chatSettings.responseStylesTitle',
|
||||
@@ -26,7 +27,7 @@ const i18n = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
export default function ChatSettingsSection({ sessionId }: { sessionId?: string }) {
|
||||
export default function ChatSettingsSection() {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
@@ -37,7 +38,7 @@ export default function ChatSettingsSection({ sessionId }: { sessionId?: string
|
||||
<CardDescription>{intl.formatMessage(i18n.modeDescription)}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="px-2">
|
||||
<ModeSection sessionId={sessionId} />
|
||||
<ModeSection />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -2,18 +2,14 @@ import { useEffect, useState, useCallback } from 'react';
|
||||
import { all_goose_modes, ModeSelectionItem } from './ModeSelectionItem';
|
||||
import { useConfig } from '../../ConfigContext';
|
||||
import { ConversationLimitsDropdown } from './ConversationLimitsDropdown';
|
||||
import { updateSession } from '../../../api';
|
||||
|
||||
export const ModeSection = ({ sessionId }: { sessionId?: string }) => {
|
||||
export const ModeSection = () => {
|
||||
const [currentMode, setCurrentMode] = useState('auto');
|
||||
const [maxTurns, setMaxTurns] = useState<number>(1000);
|
||||
const { config, read, upsert } = useConfig();
|
||||
|
||||
const handleModeChange = async (newMode: string) => {
|
||||
try {
|
||||
if (sessionId) {
|
||||
await updateSession({ body: { session_id: sessionId, goose_mode: newMode } });
|
||||
}
|
||||
await upsert('GOOSE_MODE', newMode, false);
|
||||
setCurrentMode(newMode);
|
||||
} catch (error) {
|
||||
|
||||
@@ -210,10 +210,10 @@
|
||||
"defaultMessage": "Waiting for images to save..."
|
||||
},
|
||||
"chatSettings.modeDescription": {
|
||||
"defaultMessage": "Configure how Goose interacts with tools and extensions"
|
||||
"defaultMessage": "Choose the default mode Goose uses for new sessions. Existing sessions keep their current mode."
|
||||
},
|
||||
"chatSettings.modeTitle": {
|
||||
"defaultMessage": "Mode"
|
||||
"defaultMessage": "Default Mode"
|
||||
},
|
||||
"chatSettings.responseStylesDescription": {
|
||||
"defaultMessage": "Choose how Goose should format and style its responses"
|
||||
|
||||
Reference in New Issue
Block a user