chore: Format agent code (#1077)

This commit is contained in:
Fangyin Cheng 2024-01-17 10:26:48 +08:00 committed by GitHub
parent 74eb15e01c
commit 9bdb4f94b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 56 additions and 54 deletions

View File

@ -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
```
3. Install the project requirements
```
pip install -e ".[default]"
```
4. Install pre-commit hooks
```
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"
```
6. Make your changes to the code or 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 .
```
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"
```
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
```
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

View File

@ -8,9 +8,9 @@ from .expand.code_assistant_agent import CodeAssistantAgent
from .expand.dashboard_assistant_agent import DashboardAssistantAgent
from .expand.data_scientist_agent import DataScientistAgent
from .expand.plugin_assistant_agent import PluginAssistantAgent
from .expand.retrieve_summary_assistant_agent import RetrieveSummaryAssistantAgent
from .expand.sql_assistant_agent import SQLAssistantAgent
from .expand.summary_assistant_agent import SummaryAssistantAgent
from .expand.retrieve_summary_assistant_agent import RetrieveSummaryAssistantAgent
logger = logging.getLogger(__name__)

View File

@ -2,6 +2,8 @@ import logging
from pathlib import Path
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.vis import VisPlugin, vis_client
@ -20,9 +22,6 @@ except ImportError:
return x
# TODO
from dbgpt.configs.model_config import PLUGINS_DIR
logger = logging.getLogger(__name__)

View File

@ -1,26 +1,23 @@
import os
import glob
import requests
import logging
import tiktoken
import pypdf
import asyncio
import glob
import json
import logging
import os
import pdb
from typing import Callable, Dict, List, Literal, Optional, Union
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 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.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.core.interface.message import ModelMessageRoleType
try:
from termcolor import colored
@ -581,7 +578,6 @@ if __name__ == "__main__":
from dbgpt.agent.agents.agent import AgentContext
from dbgpt.agent.agents.user_proxy_agent import UserProxyAgent
from dbgpt.core.interface.llm import ModelMetadata
from dbgpt.model import OpenAILLMClient

View File

@ -1,3 +1,4 @@
import logging
from typing import Callable, Dict, Literal, Optional, Union
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 ..agent import Agent, AgentContext
import logging
logger = logging.getLogger()

View File

@ -1,7 +1,7 @@
from __future__ import annotations
from enum import Enum
import dataclasses
from enum import Enum
from typing import Any, Dict, List, Optional, Tuple, Union

View File

@ -1,18 +1,15 @@
from __future__ import annotations
import asyncio
import json
import logging
from enum import Enum
from datetime import datetime
from asyncio import Queue, QueueEmpty, wait_for
from datetime import datetime
from enum import Enum
from json import JSONDecodeError
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union
from pydantic import (
BaseModel,
ConfigDict,
Field,
PrivateAttr,
)
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
logger = logging.getLogger(__name__)

View File

@ -5,10 +5,10 @@ from collections import defaultdict
from typing import Dict, List, Optional
from dbgpt.util.json_utils import EnhancedJSONEncoder
from dbgpt.vis.client import VisAgentMessages, VisAgentPlans, vis_client
from .base import GptsMessage, GptsMessageMemory, GptsPlansMemory
from .default_gpts_memory import DefaultGptsMessageMemory, DefaultGptsPlansMemory
from dbgpt.vis.client import vis_client, VisAgentMessages, VisAgentPlans
class GptsMemory:

View File

@ -28,6 +28,7 @@ from dbgpt.datasource.db_conn_info import DBConfig, DbTypeInfo
from dbgpt.model.base import FlatSupportedModel
from dbgpt.model.cluster import BaseModelController, WorkerManager, WorkerManagerFactory
from dbgpt.rag.summary.db_summary_client import DBSummaryClient
from dbgpt.serve.agent.agents.controller import multi_agents
from dbgpt.util.executor_utils import (
DefaultExecutorFactory,
ExecutorFactory,
@ -35,8 +36,6 @@ from dbgpt.util.executor_utils import (
)
from dbgpt.util.tracer import SpanType, root_tracer
from dbgpt.serve.agent.agents.controller import multi_agents
router = APIRouter()
CFG = Config()
CHAT_FACTORY = ChatFactory()

View File

@ -4,7 +4,7 @@ import logging
import uuid
from abc import ABC
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.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.memory.gpts_memory import GptsMemory
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.core.interface.message import StorageConversation
from dbgpt.model.cluster import WorkerManagerFactory
from dbgpt.model.cluster.client import DefaultLLMClient
from dbgpt.serve.agent.model import PagenationFilter, PluginHubFilter
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_manage_db import GptsInstanceDao, GptsInstanceEntity
@ -28,11 +32,6 @@ from ..team.base import TeamMode
from ..team.layout.team_awel_layout import AwelLayoutChatManager
from .db_gpts_memory import MetaDbGptsMessageMemory, MetaDbGptsPlansMemory
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()

View File

@ -1,13 +1,13 @@
from datetime import datetime
from sqlalchemy import (
Boolean,
Column,
DateTime,
Integer,
String,
Text,
UniqueConstraint,
Boolean,
)
from dbgpt.storage.metadata import BaseDao, Model

View File

@ -1,8 +1,9 @@
from typing import Optional
from ..base import Vis
from webdriver_manager.chrome import ChromeDriverManager
from ..base import Vis
class VisDbgptsFlowResult(Vis):
@classmethod