Skip to content

Commit

Permalink
refactor: Modify default webserver port to 5670 (#1410)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyinc authored Apr 12, 2024
1 parent aea575e commit c3ae191
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#*******************************************************************#
#** Webserver Port **#
#*******************************************************************#
WEB_SERVER_PORT=7860
# DBGPT_WEBSERVER_PORT=5670

#*******************************************************************#
#*** LLM PROVIDER ***#
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/_private/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self) -> None:

# Gradio language version: en, zh
self.LANGUAGE = os.getenv("LANGUAGE", "en")
self.WEB_SERVER_PORT = int(os.getenv("WEB_SERVER_PORT", 5000))
self.DBGPT_WEBSERVER_PORT = int(os.getenv("DBGPT_WEBSERVER_PORT", 5670))

self.debug_mode = False
self.skip_reprompt = False
Expand Down
10 changes: 3 additions & 7 deletions dbgpt/agent/expand/retrieve_summary_assistant_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,10 @@ async def generate_reply(
reply_message.success = is_success
return reply_message

async def verify(
self,
message: AgentMessage,
sender: Agent,
reviewer: Optional[Agent] = None,
**kwargs,
async def correctness_check(
self, message: AgentMessage
) -> Tuple[bool, Optional[str]]:
"""Verify the correctness of the message."""
"""Verify the correctness of the results."""
action_report = message.action_report
task_result = ""
if action_report:
Expand Down
4 changes: 2 additions & 2 deletions dbgpt/app/dbgpt_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def initialize_app(param: WebServerParameters = None, args: List[str] = None):

model_name = param.model_name or CFG.LLM_MODEL
param.model_name = model_name
param.port = param.port or CFG.WEB_SERVER_PORT
param.port = param.port or CFG.DBGPT_WEBSERVER_PORT
if not param.port:
param.port = 5000
param.port = 5670

print(param)

Expand Down
2 changes: 1 addition & 1 deletion dbgpt/app/knowledge/_cli/knowledge_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from dbgpt.configs.model_config import DATASETS_DIR

_DEFAULT_API_ADDRESS: str = "http://127.0.0.1:5000"
_DEFAULT_API_ADDRESS: str = "http://127.0.0.1:5670"
API_ADDRESS: str = _DEFAULT_API_ADDRESS

logger = logging.getLogger("dbgpt_cli")
Expand Down
10 changes: 5 additions & 5 deletions dbgpt/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(
Args:
api_base: Optional[str], a full URL for the DB-GPT API.
Defaults to the `http://localhost:5000/api/v2`.
Defaults to the `http://localhost:5670/api/v2`.
api_key: Optional[str], The dbgpt api key to use for authentication.
Defaults to None.
timeout: Optional[httpx._types.TimeoutTypes]: The timeout to use.
Expand All @@ -77,14 +77,14 @@ def __init__(
from dbgpt.client import Client
DBGPT_API_BASE = "http://localhost:5000/api/v2"
DBGPT_API_BASE = "http://localhost:5670/api/v2"
DBGPT_API_KEY = "dbgpt"
client = Client(api_base=DBGPT_API_BASE, api_key=DBGPT_API_KEY)
client.chat(model="chatgpt_proxyllm", messages="Hello?")
"""
if not api_base:
api_base = os.getenv(
"DBGPT_API_BASE", f"http://localhost:5000/{CLIENT_API_PATH}/{version}"
"DBGPT_API_BASE", f"http://localhost:5670/{CLIENT_API_PATH}/{version}"
)
if not api_key:
api_key = os.getenv("DBGPT_API_KEY")
Expand Down Expand Up @@ -146,7 +146,7 @@ async def chat(
from dbgpt.client import Client
DBGPT_API_BASE = "http://localhost:5000/api/v2"
DBGPT_API_BASE = "http://localhost:5670/api/v2"
DBGPT_API_KEY = "dbgpt"
client = Client(api_base=DBGPT_API_BASE, api_key=DBGPT_API_KEY)
res = await client.chat(model="chatgpt_proxyllm", messages="Hello?")
Expand Down Expand Up @@ -222,7 +222,7 @@ async def chat_stream(
from dbgpt.client import Client
DBGPT_API_BASE = "http://localhost:5000/api/v2"
DBGPT_API_BASE = "http://localhost:5670/api/v2"
DBGPT_API_KEY = "dbgpt"
client = Client(api_base=DBGPT_API_BASE, api_key=DBGPT_API_KEY)
res = await client.chat_stream(model="chatgpt_proxyllm", messages="Hello?")
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/model/cluster/worker/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def initialize_worker_manager_in_client(
model_path: str = None,
run_locally: bool = True,
controller_addr: str = None,
local_port: int = 5000,
local_port: int = 5670,
embedding_model_name: str = None,
embedding_model_path: str = None,
start_listener: Callable[["WorkerManager"], None] = None,
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/util/benchmarks/llm/llm_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# or vllm
model_type = "huggingface"

controller_addr = "http://127.0.0.1:5000"
controller_addr = "http://127.0.0.1:5670"

result_csv_file = None

Expand Down
6 changes: 3 additions & 3 deletions dbgpt/util/command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _run_current_with_gunicorn(app: str, config_path: str, kwargs: Dict):
env_to_app.update(os.environ)
app_env = EnvArgumentParser._kwargs_to_env_key_value(kwargs)
env_to_app.update(app_env)
cmd = f"uvicorn {app} --host 0.0.0.0 --port 5000"
cmd = f"uvicorn {app} --host 0.0.0.0 --port 5670"
if "windows" in platform.system().lower():
raise Exception("Not support on windows")
else: # macOS, Linux, and other Unix-like systems
Expand Down Expand Up @@ -137,8 +137,8 @@ def _get_ports_by_cmdline_part(service_keys: List[str]) -> List[int]:
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass

# Sort ports with preference for 8000 and 5000
ports.sort(key=lambda x: (x != 8000, x != 5000, x))
# Sort ports with preference for 8000 and 5670
ports.sort(key=lambda x: (x != 8000, x != 5670, x))
return ports


Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
env_file:
- .env.template
ports:
- 5000:5000/tcp
- 5670:5670/tcp
# webserver may be failed, it must wait all sqls in /docker-entrypoint-initdb.d execute finish.
restart: unless-stopped
networks:
Expand Down
2 changes: 1 addition & 1 deletion docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ RUN (if [ "${LANGUAGE}" = "zh" ]; \
fi;)

ENV PYTHONPATH "/app:$PYTHONPATH"
EXPOSE 5000
EXPOSE 5670

CMD ["dbgpt", "start", "webserver"]
6 changes: 3 additions & 3 deletions docs/docs/api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TabItem from '@theme/TabItem';
DBGPT_API_KEY=dbgpt
APP_ID={YOUR_APP_ID}

curl -X POST "http://localhost:5000/api/v2/chat/completions" \
curl -X POST "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
Expand Down Expand Up @@ -87,7 +87,7 @@ GET /api/v2/serve/apps/{app_id}
```shell
DBGPT_API_KEY=dbgpt
APP_ID={YOUR_APP_ID}
curl -X GET "http://localhost:5000/api/v2/serve/apps/$APP_ID" -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET "http://localhost:5670/api/v2/serve/apps/$APP_ID" -H "Authorization: Bearer $DBGPT_API_KEY"
```
</TabItem>

Expand Down Expand Up @@ -139,7 +139,7 @@ GET /api/v2/serve/apps
```shell
DBGPT_API_KEY=dbgpt

curl -X GET 'http://localhost:5000/api/v2/serve/apps' -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET 'http://localhost:5670/api/v2/serve/apps' -H "Authorization: Bearer $DBGPT_API_KEY"
```
</TabItem>

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/api/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TabItem from '@theme/TabItem';
```shell
DBGPT_API_KEY="dbgpt"

curl -X POST "http://localhost:5000/api/v2/chat/completions" \
curl -X POST "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
Expand Down Expand Up @@ -94,7 +94,7 @@ data: [DONE]
```shell
DBGPT_API_KEY="dbgpt"

curl -X POST "http://localhost:5000/api/v2/chat/completions" \
curl -X POST "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/api/datasource.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TabItem from '@theme/TabItem';
DBGPT_API_KEY=dbgpt
DB_NAME="{your_db_name}"

curl -X POST "http://localhost:5000/api/v2/chat/completions" \
curl -X POST "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
Expand Down Expand Up @@ -126,7 +126,7 @@ DELETE /api/v2/serve/datasources
DBGPT_API_KEY=dbgpt
DATASOURCE_ID={YOUR_DATASOURCE_ID}

curl -X DELETE "http://localhost:5000/api/v2/serve/datasources/$DATASOURCE_ID" \
curl -X DELETE "http://localhost:5670/api/v2/serve/datasources/$DATASOURCE_ID" \
-H "Authorization: Bearer $DBGPT_API_KEY" \

```
Expand Down Expand Up @@ -180,7 +180,7 @@ GET /api/v2/serve/datasources/{datasource_id}
DBGPT_API_KEY=dbgpt
DATASOURCE_ID={YOUR_DATASOURCE_ID}

curl -X GET "http://localhost:5000/api/v2/serve/datasources/$DATASOURCE_ID" -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET "http://localhost:5670/api/v2/serve/datasources/$DATASOURCE_ID" -H "Authorization: Bearer $DBGPT_API_KEY"

```
</TabItem>
Expand Down Expand Up @@ -234,7 +234,7 @@ GET /api/v2/serve/datasources
```shell
DBGPT_API_KEY=dbgpt

curl -X GET "http://localhost:5000/api/v2/serve/datasources" -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET "http://localhost:5670/api/v2/serve/datasources" -H "Authorization: Bearer $DBGPT_API_KEY"

```
</TabItem>
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/api/flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TabItem from '@theme/TabItem';
DBGPT_API_KEY=dbgpt
FLOW_ID={YOUR_FLOW_ID}

curl -X POST "http://localhost:5000/api/v2/chat/completions" \
curl -X POST "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
Expand Down Expand Up @@ -107,7 +107,7 @@ DELETE /api/v2/serve/awel/flows
DBGPT_API_KEY=dbgpt
FLOW_ID={YOUR_FLOW_ID}

curl -X DELETE "http://localhost:5000/api/v2/serve/awel/flows/$FLOW_ID" \
curl -X DELETE "http://localhost:5670/api/v2/serve/awel/flows/$FLOW_ID" \
-H "Authorization: Bearer $DBGPT_API_KEY" \

```
Expand Down Expand Up @@ -161,7 +161,7 @@ GET /api/v2/serve/awel/flows/{flow_id}
DBGPT_API_KEY=dbgpt
FLOW_ID={YOUR_FLOW_ID}

curl -X GET "http://localhost:5000/api/v2/serve/awel/flows/$FLOW_ID" -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET "http://localhost:5670/api/v2/serve/awel/flows/$FLOW_ID" -H "Authorization: Bearer $DBGPT_API_KEY"

```
</TabItem>
Expand Down Expand Up @@ -215,7 +215,7 @@ GET /api/v2/serve/awel/flows
```shell
DBGPT_API_KEY=dbgpt

curl -X GET "http://localhost:5000/api/v2/serve/awel/flows" -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET "http://localhost:5670/api/v2/serve/awel/flows" -H "Authorization: Bearer $DBGPT_API_KEY"

```
</TabItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All API requests should include your API key in an Authorization HTTP header as
Example with the DB-GPT API curl command:

```bash
curl "http://localhost:5000/api/v2/chat/completions" \
curl "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
```
Example with the DB-GPT Client Python package:
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/api/knowledge.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TabItem from '@theme/TabItem';
DBGPT_API_KEY=dbgpt
SPACE_NAME={YOUR_SPACE_NAME}

curl -X POST "http://localhost:5000/api/v2/chat/completions" \
curl -X POST "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
Expand Down Expand Up @@ -334,7 +334,7 @@ POST /api/v2/serve/knowledge/spaces
```shell
DBGPT_API_KEY="dbgpt"

curl --location --request POST 'http://localhost:5000/api/v2/serve/knowledge/spaces' \
curl --location --request POST 'http://localhost:5670/api/v2/serve/knowledge/spaces' \
--header 'Authorization: Bearer $DBGPT_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"desc": "for client space desc", "name": "test_space_2", "owner": "dbgpt", "vector_type": "Chroma"
Expand Down Expand Up @@ -410,7 +410,7 @@ PUT /api/v2/serve/knowledge/spaces
```shell
DBGPT_API_KEY="dbgpt"

curl --location --request PUT 'http://localhost:5000/api/v2/serve/knowledge/spaces' \
curl --location --request PUT 'http://localhost:5670/api/v2/serve/knowledge/spaces' \
--header 'Authorization: Bearer $DBGPT_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"desc": "for client space desc v2", "id": "49", "name": "test_space_2", "owner": "dbgpt", "vector_type": "Chroma"
Expand Down Expand Up @@ -493,7 +493,7 @@ DELETE /api/v2/serve/knowledge/spaces
DBGPT_API_KEY=dbgpt
SPACE_ID={YOUR_SPACE_ID}

curl -X DELETE "http://localhost:5000/api/v2/serve/knowledge/spaces/$SPACE_ID" \
curl -X DELETE "http://localhost:5670/api/v2/serve/knowledge/spaces/$SPACE_ID" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
Expand Down Expand Up @@ -548,7 +548,7 @@ GET /api/v2/serve/knowledge/spaces/{space_id}
```shell
DBGPT_API_KEY=dbgpt
SPACE_ID={YOUR_SPACE_ID}
curl -X GET "http://localhost:5000/api/v2/serve/knowledge/spaces/$SPACE_ID" -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET "http://localhost:5670/api/v2/serve/knowledge/spaces/$SPACE_ID" -H "Authorization: Bearer $DBGPT_API_KEY"
```
</TabItem>

Expand Down Expand Up @@ -600,7 +600,7 @@ GET /api/v2/serve/knowledge/spaces
```shell
DBGPT_API_KEY=dbgpt

curl -X GET 'http://localhost:5000/api/v2/serve/knowledge/spaces' -H "Authorization: Bearer $DBGPT_API_KEY"
curl -X GET 'http://localhost:5670/api/v2/serve/knowledge/spaces' -H "Authorization: Bearer $DBGPT_API_KEY"
```
</TabItem>

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/application/advanced_tutorial/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ print(completion.choices[0].message.content)


## Application service layer API
The service layer API refers to the API exposed on port 5000 after starting the webserver, which is mainly focused on the application layer. It can be divided into the following parts according to categories
The service layer API refers to the API exposed on port 5670 after starting the webserver, which is mainly focused on the application layer. It can be divided into the following parts according to categories

- Chat API
- Editor API
Expand All @@ -37,7 +37,7 @@ The service layer API refers to the API exposed on port 5000 after starting the
- Model API

:::info
Note: After starting the webserver, open http://127.0.0.1:5000/docs to view details
Note: After starting the webserver, open http://127.0.0.1:5670/docs to view details

Regarding the service layer API, in terms of strategy in the early days, we maintained the principle of minimum availability and openness. APIs that are stably exposed to the outside world will carry version information, such as
- /api/v1/
Expand Down Expand Up @@ -164,5 +164,5 @@ Currently, due to frequent changes in Knowledge and Prompt, the relevant APIs ar

:::

More detailed interface parameters can be viewed at `http://127.0.0.1:5000/docs`
More detailed interface parameters can be viewed at `http://127.0.0.1:5670/docs`

4 changes: 2 additions & 2 deletions docs/docs/application/advanced_tutorial/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Usage: dbgpt knowledge [OPTIONS] COMMAND [ARGS]...
Options:
--address TEXT Address of the Api server(If not set, try to read from
environment variable: API_ADDRESS). [default:
http://127.0.0.1:5000]
http://127.0.0.1:5670]
--help Show this message and exit.

Commands:
Expand Down Expand Up @@ -374,7 +374,7 @@ INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
```

#### Webserver command
The front-end service can be started through `dbgpt start webserver`, the default port is 5000, and can be accessed through `http://127.0.0.1:5000`
The front-end service can be started through `dbgpt start webserver`, the default port is 5670, and can be accessed through `http://127.0.0.1:5670`

```python
~ dbgpt start webserver --help
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/awel/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ with DAG("simple_dag_example") as dag:
Before performing access verification, the project needs to be started first: `python dbgpt/app/dbgpt_server.py`

```bash
% curl -X GET http://127.0.0.1:5000/api/v1/awel/trigger/examples/hello\?name\=zhangsan
% curl -X GET http://127.0.0.1:5670/api/v1/awel/trigger/examples/hello\?name\=zhangsan
"Hello, zhangsan, your age is 18"
```

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/faq/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can try to use gradio's [network](https://github.com/gradio-app/gradio/blob/
import secrets
from gradio import networking
token=secrets.token_urlsafe(32)
local_port=5000
local_port=5670
url = networking.setup_tunnel('0.0.0.0', local_port, token)
print(f'Public url: {url}')
time.sleep(60 * 60 * 24)
Expand Down
Loading

0 comments on commit c3ae191

Please sign in to comment.