mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-23 20:26:15 +00:00
chore: Format agent code (#1077)
This commit is contained in:
parent
74eb15e01c
commit
9bdb4f94b8
@ -8,50 +8,62 @@ To contribute to this GitHub project, you can follow these steps:
|
|||||||
```
|
```
|
||||||
git clone https://github.com/<YOUR-GITHUB-USERNAME>/DB-GPT
|
git clone https://github.com/<YOUR-GITHUB-USERNAME>/DB-GPT
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install the project requirements
|
3. Install the project requirements
|
||||||
```
|
```
|
||||||
pip install -e ".[default]"
|
pip install -e ".[default]"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Install pre-commit hooks
|
4. Install pre-commit hooks
|
||||||
```
|
```
|
||||||
pre-commit install
|
pre-commit install
|
||||||
```
|
```
|
||||||
5. Create a new branch for your changes using the following command:
|
|
||||||
|
|
||||||
|
5. Create a new branch for your changes using the following command:
|
||||||
```
|
```
|
||||||
git checkout -b "branch-name"
|
git checkout -b "branch-name"
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Make your changes to the code or documentation.
|
6. Make your changes to the code or documentation.
|
||||||
|
|
||||||
- Example: Improve User Interface or Add Documentation.
|
- Example: Improve User Interface or Add Documentation.
|
||||||
|
|
||||||
|
7. Format the code using the following command:
|
||||||
|
```
|
||||||
|
make fmt
|
||||||
|
```
|
||||||
|
|
||||||
7. Add the changes to the staging area using the following command:
|
8. Add the changes to the staging area using the following command:
|
||||||
```
|
```
|
||||||
git add .
|
git add .
|
||||||
```
|
```
|
||||||
|
|
||||||
8. Commit the changes with a meaningful commit message using the following command:
|
9. Make sure the tests pass and your code lints using the following command:
|
||||||
|
```
|
||||||
|
make pre-commit
|
||||||
|
```
|
||||||
|
|
||||||
|
10. Commit the changes with a meaningful commit message using the following command:
|
||||||
```
|
```
|
||||||
git commit -m "your commit message"
|
git commit -m "your commit message"
|
||||||
```
|
```
|
||||||
9. Push the changes to your forked repository using the following command:
|
11. Push the changes to your forked repository using the following command:
|
||||||
```
|
```
|
||||||
git push origin branch-name
|
git push origin branch-name
|
||||||
```
|
```
|
||||||
10. Go to the GitHub website and navigate to your forked repository.
|
12. Go to the GitHub website and navigate to your forked repository.
|
||||||
|
|
||||||
11. Click the "New pull request" button.
|
13. Click the "New pull request" button.
|
||||||
|
|
||||||
12. Select the branch you just pushed to and the branch you want to merge into on the original repository.
|
14. Select the branch you just pushed to and the branch you want to merge into on the original repository.
|
||||||
|
|
||||||
13. Add a description of your changes and click the "Create pull request" button.
|
15. Add a description of your changes and click the "Create pull request" button.
|
||||||
|
|
||||||
14. Wait for the project maintainer to review your changes and provide feedback.
|
16. Wait for the project maintainer to review your changes and provide feedback.
|
||||||
|
|
||||||
15. Make any necessary changes based on feedback and repeat steps 5-12 until your changes are accepted and merged into the main project.
|
17. Make any necessary changes based on feedback and repeat steps 5-12 until your changes are accepted and merged into the main project.
|
||||||
|
|
||||||
16. Once your changes are merged, you can update your forked repository and local copy of the repository with the following commands:
|
18. Once your changes are merged, you can update your forked repository and local copy of the repository with the following commands:
|
||||||
|
|
||||||
```
|
```
|
||||||
git fetch upstream
|
git fetch upstream
|
||||||
|
@ -8,9 +8,9 @@ from .expand.code_assistant_agent import CodeAssistantAgent
|
|||||||
from .expand.dashboard_assistant_agent import DashboardAssistantAgent
|
from .expand.dashboard_assistant_agent import DashboardAssistantAgent
|
||||||
from .expand.data_scientist_agent import DataScientistAgent
|
from .expand.data_scientist_agent import DataScientistAgent
|
||||||
from .expand.plugin_assistant_agent import PluginAssistantAgent
|
from .expand.plugin_assistant_agent import PluginAssistantAgent
|
||||||
|
from .expand.retrieve_summary_assistant_agent import RetrieveSummaryAssistantAgent
|
||||||
from .expand.sql_assistant_agent import SQLAssistantAgent
|
from .expand.sql_assistant_agent import SQLAssistantAgent
|
||||||
from .expand.summary_assistant_agent import SummaryAssistantAgent
|
from .expand.summary_assistant_agent import SummaryAssistantAgent
|
||||||
from .expand.retrieve_summary_assistant_agent import RetrieveSummaryAssistantAgent
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ import logging
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable, Dict, Literal, Optional, Union
|
from typing import Callable, Dict, Literal, Optional, Union
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
from dbgpt.configs.model_config import PLUGINS_DIR
|
||||||
from dbgpt.util.json_utils import find_json_objects
|
from dbgpt.util.json_utils import find_json_objects
|
||||||
from dbgpt.vis import VisPlugin, vis_client
|
from dbgpt.vis import VisPlugin, vis_client
|
||||||
|
|
||||||
@ -20,9 +22,6 @@ except ImportError:
|
|||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
|
||||||
from dbgpt.configs.model_config import PLUGINS_DIR
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,26 +1,23 @@
|
|||||||
import os
|
|
||||||
import glob
|
|
||||||
import requests
|
|
||||||
import logging
|
|
||||||
import tiktoken
|
|
||||||
import pypdf
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import glob
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
import pdb
|
import pdb
|
||||||
|
from typing import Callable, Dict, List, Literal, Optional, Union
|
||||||
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from typing import Callable, Dict, Literal, Optional, Union, List
|
|
||||||
|
import pypdf
|
||||||
|
import requests
|
||||||
|
import tiktoken
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
from dbgpt.agent.agents.base_agent import ConversableAgent
|
|
||||||
from dbgpt.agent.plugin.commands.command_mange import ApiCall
|
|
||||||
|
|
||||||
from dbgpt.agent.memory.gpts_memory import GptsMemory
|
|
||||||
from dbgpt.agent.agents.agent import Agent, AgentContext
|
from dbgpt.agent.agents.agent import Agent, AgentContext
|
||||||
from dbgpt.core.interface.message import ModelMessageRoleType
|
from dbgpt.agent.agents.base_agent import ConversableAgent
|
||||||
|
from dbgpt.agent.memory.gpts_memory import GptsMemory
|
||||||
|
from dbgpt.agent.plugin.commands.command_mange import ApiCall
|
||||||
from dbgpt.configs.model_config import PILOT_PATH
|
from dbgpt.configs.model_config import PILOT_PATH
|
||||||
|
from dbgpt.core.interface.message import ModelMessageRoleType
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from termcolor import colored
|
from termcolor import colored
|
||||||
@ -581,7 +578,6 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
from dbgpt.agent.agents.agent import AgentContext
|
from dbgpt.agent.agents.agent import AgentContext
|
||||||
from dbgpt.agent.agents.user_proxy_agent import UserProxyAgent
|
from dbgpt.agent.agents.user_proxy_agent import UserProxyAgent
|
||||||
|
|
||||||
from dbgpt.core.interface.llm import ModelMetadata
|
from dbgpt.core.interface.llm import ModelMetadata
|
||||||
from dbgpt.model import OpenAILLMClient
|
from dbgpt.model import OpenAILLMClient
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from typing import Callable, Dict, Literal, Optional, Union
|
from typing import Callable, Dict, Literal, Optional, Union
|
||||||
|
|
||||||
from dbgpt.agent.agents.base_agent import ConversableAgent
|
from dbgpt.agent.agents.base_agent import ConversableAgent
|
||||||
@ -6,8 +7,6 @@ from dbgpt.core.interface.message import ModelMessageRoleType
|
|||||||
from ...memory.gpts_memory import GptsMemory
|
from ...memory.gpts_memory import GptsMemory
|
||||||
from ..agent import Agent, AgentContext
|
from ..agent import Agent, AgentContext
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from enum import Enum
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from enum import Enum
|
|
||||||
from datetime import datetime
|
|
||||||
from asyncio import Queue, QueueEmpty, wait_for
|
from asyncio import Queue, QueueEmpty, wait_for
|
||||||
|
from datetime import datetime
|
||||||
|
from enum import Enum
|
||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union
|
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union
|
||||||
from pydantic import (
|
|
||||||
BaseModel,
|
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
||||||
ConfigDict,
|
|
||||||
Field,
|
|
||||||
PrivateAttr,
|
|
||||||
)
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ from collections import defaultdict
|
|||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from dbgpt.util.json_utils import EnhancedJSONEncoder
|
from dbgpt.util.json_utils import EnhancedJSONEncoder
|
||||||
|
from dbgpt.vis.client import VisAgentMessages, VisAgentPlans, vis_client
|
||||||
|
|
||||||
from .base import GptsMessage, GptsMessageMemory, GptsPlansMemory
|
from .base import GptsMessage, GptsMessageMemory, GptsPlansMemory
|
||||||
from .default_gpts_memory import DefaultGptsMessageMemory, DefaultGptsPlansMemory
|
from .default_gpts_memory import DefaultGptsMessageMemory, DefaultGptsPlansMemory
|
||||||
from dbgpt.vis.client import vis_client, VisAgentMessages, VisAgentPlans
|
|
||||||
|
|
||||||
|
|
||||||
class GptsMemory:
|
class GptsMemory:
|
||||||
|
@ -28,6 +28,7 @@ from dbgpt.datasource.db_conn_info import DBConfig, DbTypeInfo
|
|||||||
from dbgpt.model.base import FlatSupportedModel
|
from dbgpt.model.base import FlatSupportedModel
|
||||||
from dbgpt.model.cluster import BaseModelController, WorkerManager, WorkerManagerFactory
|
from dbgpt.model.cluster import BaseModelController, WorkerManager, WorkerManagerFactory
|
||||||
from dbgpt.rag.summary.db_summary_client import DBSummaryClient
|
from dbgpt.rag.summary.db_summary_client import DBSummaryClient
|
||||||
|
from dbgpt.serve.agent.agents.controller import multi_agents
|
||||||
from dbgpt.util.executor_utils import (
|
from dbgpt.util.executor_utils import (
|
||||||
DefaultExecutorFactory,
|
DefaultExecutorFactory,
|
||||||
ExecutorFactory,
|
ExecutorFactory,
|
||||||
@ -35,8 +36,6 @@ from dbgpt.util.executor_utils import (
|
|||||||
)
|
)
|
||||||
from dbgpt.util.tracer import SpanType, root_tracer
|
from dbgpt.util.tracer import SpanType, root_tracer
|
||||||
|
|
||||||
from dbgpt.serve.agent.agents.controller import multi_agents
|
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
CFG = Config()
|
CFG = Config()
|
||||||
CHAT_FACTORY = ChatFactory()
|
CHAT_FACTORY = ChatFactory()
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
import uuid
|
import uuid
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import Dict, List, Any, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from fastapi import APIRouter, Body
|
from fastapi import APIRouter, Body
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
@ -16,11 +16,15 @@ from dbgpt.agent.agents.user_proxy_agent import UserProxyAgent
|
|||||||
from dbgpt.agent.common.schema import Status
|
from dbgpt.agent.common.schema import Status
|
||||||
from dbgpt.agent.memory.gpts_memory import GptsMemory
|
from dbgpt.agent.memory.gpts_memory import GptsMemory
|
||||||
from dbgpt.app.openapi.api_view_model import Result
|
from dbgpt.app.openapi.api_view_model import Result
|
||||||
|
from dbgpt.app.scene.base import ChatScene
|
||||||
from dbgpt.component import BaseComponent, ComponentType, SystemApp
|
from dbgpt.component import BaseComponent, ComponentType, SystemApp
|
||||||
|
from dbgpt.core.interface.message import StorageConversation
|
||||||
from dbgpt.model.cluster import WorkerManagerFactory
|
from dbgpt.model.cluster import WorkerManagerFactory
|
||||||
from dbgpt.model.cluster.client import DefaultLLMClient
|
from dbgpt.model.cluster.client import DefaultLLMClient
|
||||||
from dbgpt.serve.agent.model import PagenationFilter, PluginHubFilter
|
from dbgpt.serve.agent.model import PagenationFilter, PluginHubFilter
|
||||||
from dbgpt.serve.agent.team.plan.team_auto_plan import AutoPlanChatManager
|
from dbgpt.serve.agent.team.plan.team_auto_plan import AutoPlanChatManager
|
||||||
|
from dbgpt.serve.conversation.serve import Serve as ConversationServe
|
||||||
|
from dbgpt.util.json_utils import serialize
|
||||||
|
|
||||||
from ..db.gpts_conversations_db import GptsConversationsDao, GptsConversationsEntity
|
from ..db.gpts_conversations_db import GptsConversationsDao, GptsConversationsEntity
|
||||||
from ..db.gpts_manage_db import GptsInstanceDao, GptsInstanceEntity
|
from ..db.gpts_manage_db import GptsInstanceDao, GptsInstanceEntity
|
||||||
@ -28,11 +32,6 @@ from ..team.base import TeamMode
|
|||||||
from ..team.layout.team_awel_layout import AwelLayoutChatManager
|
from ..team.layout.team_awel_layout import AwelLayoutChatManager
|
||||||
from .db_gpts_memory import MetaDbGptsMessageMemory, MetaDbGptsPlansMemory
|
from .db_gpts_memory import MetaDbGptsMessageMemory, MetaDbGptsPlansMemory
|
||||||
from .dbgpts import DbGptsInstance
|
from .dbgpts import DbGptsInstance
|
||||||
from dbgpt.util.json_utils import serialize
|
|
||||||
|
|
||||||
from dbgpt.serve.conversation.serve import Serve as ConversationServe
|
|
||||||
from dbgpt.core.interface.message import StorageConversation
|
|
||||||
from dbgpt.app.scene.base import ChatScene
|
|
||||||
|
|
||||||
CFG = Config()
|
CFG = Config()
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from sqlalchemy import (
|
from sqlalchemy import (
|
||||||
|
Boolean,
|
||||||
Column,
|
Column,
|
||||||
DateTime,
|
DateTime,
|
||||||
Integer,
|
Integer,
|
||||||
String,
|
String,
|
||||||
Text,
|
Text,
|
||||||
UniqueConstraint,
|
UniqueConstraint,
|
||||||
Boolean,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from dbgpt.storage.metadata import BaseDao, Model
|
from dbgpt.storage.metadata import BaseDao, Model
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from ..base import Vis
|
|
||||||
from webdriver_manager.chrome import ChromeDriverManager
|
from webdriver_manager.chrome import ChromeDriverManager
|
||||||
|
|
||||||
|
from ..base import Vis
|
||||||
|
|
||||||
|
|
||||||
class VisDbgptsFlowResult(Vis):
|
class VisDbgptsFlowResult(Vis):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user