include sessionId in tool request (#5394)

This commit is contained in:
Amed Rodriguez
2025-10-27 11:14:02 -07:00
committed by GitHub
parent 9afaedcc6a
commit f0cffdb4ac
@@ -9,6 +9,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
} from '../../ui/dropdown-menu';
import { useChatContext } from '../../../contexts/ChatContext';
function getFirstSentence(text: string): string {
const match = text.match(/^([^.?!]+[.?!])/);
@@ -27,6 +28,9 @@ export default function PermissionModal({ extensionName, onClose }: PermissionMo
{ value: 'never_allow', label: 'Never allow' },
] as { value: PermissionLevel; label: string }[];
const chatContext = useChatContext();
const sessionId = chatContext?.chat.sessionId || '';
const [tools, setTools] = useState<ToolInfo[]>([]);
const [updatedPermissions, setUpdatedPermissions] = useState<Record<string, string>>({});
@@ -41,8 +45,7 @@ export default function PermissionModal({ extensionName, onClose }: PermissionMo
const fetchTools = async () => {
try {
const response = await getTools({
// TODO(Douwe): pass session ID or maybe? do we configure the tools for the agent or globally?
query: { extension_name: extensionName, session_id: '' },
query: { extension_name: extensionName, session_id: sessionId },
});
if (response.error) {
console.error('Failed to get tools');
@@ -59,7 +62,7 @@ export default function PermissionModal({ extensionName, onClose }: PermissionMo
};
fetchTools();
}, [extensionName]);
}, [extensionName, sessionId]);
const handleSettingChange = (toolName: string, newPermission: PermissionLevel) => {
setUpdatedPermissions((prev) => ({