feat: api tool config section + agent refactor for more llm fields

This commit is contained in:
Siddhant Rai
2025-02-03 06:07:10 +05:30
parent 9319ec5bb2
commit a5b2eb3a28
13 changed files with 1048 additions and 250 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@ import { useDarkTheme } from '../hooks';
import AddToolModal from '../modals/AddToolModal';
import { ActiveState } from '../models/misc';
import ToolConfig from './ToolConfig';
import { UserTool } from './types';
import { APIToolType, UserToolType } from './types';
export default function Tools() {
const { t } = useTranslation();
@@ -18,8 +18,10 @@ export default function Tools() {
const [searchTerm, setSearchTerm] = React.useState('');
const [addToolModalState, setAddToolModalState] =
React.useState<ActiveState>('INACTIVE');
const [userTools, setUserTools] = React.useState<UserTool[]>([]);
const [selectedTool, setSelectedTool] = React.useState<UserTool | null>(null);
const [userTools, setUserTools] = React.useState<UserToolType[]>([]);
const [selectedTool, setSelectedTool] = React.useState<
UserToolType | APIToolType | null
>(null);
const getUserTools = () => {
userService
@@ -47,7 +49,7 @@ export default function Tools() {
});
};
const handleSettingsClick = (tool: UserTool) => {
const handleSettingsClick = (tool: UserToolType) => {
setSelectedTool(tool);
};

View File

@@ -19,7 +19,19 @@ export type LogData = {
timestamp: string;
};
export type UserTool = {
export type ParameterGroupType = {
type: 'object';
properties: {
[key: string]: {
type: 'string' | 'integer';
description: string;
value: string | number;
filled_by_llm: boolean;
};
};
};
export type UserToolType = {
id: string;
name: string;
displayName: string;
@@ -47,3 +59,23 @@ export type UserTool = {
active: boolean;
}[];
};
export type APIActionType = {
name: string;
url: string;
description: string;
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
query_params: ParameterGroupType;
headers: ParameterGroupType;
body: ParameterGroupType;
active: boolean;
};
export type APIToolType = {
id: string;
name: string;
displayName: string;
description: string;
status: boolean;
config: { actions: { [key: string]: APIActionType } };
};