Skip to content

Commit 449adb8

Browse files
authored
Use New Implementation and remove server things. (#11)
* feat(PR Reivew): ✨ New implementation of Pull Request Review Chains and Reports
1 parent 7bc2c84 commit 449adb8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1116
-1842
lines changed

.dockerignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/docker_publish.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
poetry-version: '1.5.1'
2828

2929
- name: Install Dependencies
30-
run: poetry install
30+
run: poetry install --with dev
3131

3232
- name: Run Test
3333
run:
34-
poetry run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=codedog test/ | tee pytest-coverage.txt
34+
poetry run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=codedog tests/ | tee pytest-coverage.txt
3535

3636
- name: Pytest coverage comment
3737
id: coverageComment

Dockerfile

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,49 @@ Review your Github/Gitlab PR with ChatGPT
1010

1111
## Setup Project
1212

13+
Development
14+
1315
```shell
14-
poetry install --with dev
16+
poetry install --with dev, http
1517
```
1618

1719
## Configuration
1820

21+
Codedog currently load config from environment variables .
22+
1923
settings:
2024

21-
| 环境变量 | 是否必要 | 默认值 | 说明 |
22-
| ---------------------- | -------- | --------- | ----------------------------------- |
23-
| CODEDOG_WORKER_NUM || 1 | 服务线程数 |
24-
| CODEDOG_ENV || "unknown" | 表明 codedog 实例所属环境 |
25-
| DATADOG_METRIC || | 值为 True 时向 datadog 发送统计指标 |
26-
| DATADOG_AGENT_HOST || localhost | datadog agent host |
27-
| DATADOG_DOGSTATSD_PORT || 8125 | datadog agent dogstatsd port |
28-
| GITHUB_TOKEN || | 用于连接 github 和评论 |
29-
| GITHUB_APP_ID || 0 | 用于配置 github app id |
30-
| GITHUB_APP_PRIVATE_KEY || "" | 用于认证 github app |
31-
| OPENAI_API_KEY || | 调用 OPENAI 的 API KEY |
32-
| OPENAI_PROXY || | 设置到 openai.proxy |
33-
34-
## Start Server
25+
| Config Name | Required | Default | Description |
26+
| ----------------------------- | -------- | ----------------- | --------------------------------------- |
27+
| CODEDOG_SERVER | No | 0.0.0.0 | Server address |
28+
| CODEDOG_PORT | No | 32167 | Server port |
29+
| CODEDOG_WORKER_NUM | No | 1 | Server thread number |
30+
| OPENAI_API_KEY | Yes | | Api Key for calling openai gpt4 api |
31+
| OPENAI_PROXY | No | | Openai proxy |
32+
| AZURE_OPENAI | No | | Use azure openai gpt 3.5 if not blank |
33+
| AZURE_OPENAI_API_KEY | No | | Azure openai api key |
34+
| AZURE_OPENAI_API_BASE | No | | Azure openai api base |
35+
| AZURE_OPENAI_DEPLOYMENT_ID | No | | Azure openai deployment id for gpt 3.5 |
36+
| AZURE_OPENAI_EMBEDDING_DEP_ID | No | | Azure openai deployment id for embedding|
37+
| GITHUB_TOKEN | No | | Retrieve github pr data and comment |
3538

36-
```shell
37-
poetry run start
38-
```
39+
## Usage
40+
41+
### Github Example with GPT4
42+
43+
check `example/github_review.py`
44+
45+
### server
46+
47+
We have a demo server for you to try.
48+
49+
1. Run server with:
50+
51+
```bash
52+
poetry install --with http
53+
54+
poetry run demoserver
55+
```
3956

4057
## How To Use
4158

codedog/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# flake8: noqa
2+
from codedog.actors.reporters.pull_request import PullRequestReporter
3+
from codedog.chains.code_review.base import CodeReviewChain
4+
from codedog.chains.pr_summary.base import PRSummaryChain
25

36
from .version import VERSION
47

5-
verbose: bool = False
8+
__version__ = VERSION
9+
10+
__all__ = ["CodeReviewChain", "PRSummaryChain", "PullRequestReporter"]

codedog/actors/__init__.py

Whitespace-only changes.

codedog/actors/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Actor:
2+
pass

codedog/actors/reporters/__init__.py

Whitespace-only changes.

codedog/actors/reporters/base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from abc import ABC, abstractmethod
2+
3+
from codedog.actors.base import Actor
4+
5+
6+
class Reporter(Actor, ABC):
7+
@abstractmethod
8+
def report(self) -> str:
9+
"""Generate report content text."""

0 commit comments

Comments
 (0)