mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-12-02 01:53:14 +00:00
feat: api tool config section + agent refactor for more llm fields
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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 } };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user