Commit Graph

124 Commits

Author SHA1 Message Date
Aries-ckt
d4da50330f fix: dashboard editor run error (#1380) 2024-04-07 15:04:28 +08:00
yyhhyy
f2a6284c0e fix: Fix the mypy check error (#1373)
Co-authored-by: yyhhyy <95077259+Hui824@users.noreply.github.com>
Co-authored-by: aries_ckt <916701291@qq.com>
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
2024-04-07 14:22:23 +08:00
4238a670bf fix: Fix the issue of invalid port settings (#1351) 2024-03-29 17:25:42 +08:00
Aries-ckt
dffd235bfb feat: Client support chatdata (#1343) 2024-03-28 09:04:28 +08:00
Fangyin Cheng
3a7a2cbbb8 feat: Run AWEL flow in CLI (#1341) 2024-03-27 12:50:05 +08:00
Fangyin Cheng
fcc325d411 feat(core): Support i18n (#1327) 2024-03-25 20:15:39 +08:00
Fangyin Cheng
8a17099dd2 feat(rag): Support RAG SDK (#1322) 2024-03-22 15:36:57 +08:00
明天
e65732d6e4 feat: add Client and API v2 (#1316)
# Description
1. Provide /api/v2 for DB-GPT
2.  Add DBGPT Python Client for Chat, Flow, App, Knowledge, Including:
   - Chat
   - Create
   - Update
   - Delete
   - Get
   - List
 3. Add examples in `examples/client/`
 4. Add API Reference document

# How Has This Been Tested?
## Test Chat Normal
### Curl
1. set `API_KEYS=dbgpt` in `.env`
2. `python dbgpt/app/dbgpt_server.py`
3. test with curl 
```
DBGPT_API_KEY=dbgpt
curl -X POST "http://localhost:5000/api/v2/chat/completions" \
    -H "Authorization: Bearer $DBGPT_API_KEY" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -d "{\"messages\":\"Hello\",\"model\":\"chatgpt_proxyllm\"}"
```

```
data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": "Hello"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": "!"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": " How"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": " can"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": " I"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": " assist"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": " you"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": " today"}}]}

data: {"id": "chatcmpl-ab5fd180-e699-11ee-8388-acde48001122", "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": "?"}}]}

data: [DONE]
```

### Python
```python
from dbgpt.client import Client

DBGPT_API_KEY = "dbgpt"
client = Client(api_key=DBGPT_API_KEY)
# stream
async for data in client.chat_stream(
    model="chatgpt_proxyllm",
    messages="hello",
):
   print(data)

# no stream
await client.chat(model="chatgpt_proxyllm", messages="hello")

```
## Test Chat App
### Curl
 test with curl 
```
 DBGPT_API_KEY=dbgpt
 APP_CODE={YOUR_APP_CODE}

curl -X POST "http://localhost:5000/api/v2/chat/completions" \
    -H "Authorization: Bearer $DBGPT_API_KEY" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -d "{\"messages\":\"Hello\",\"model\":\"chatgpt_proxyllm\", \"chat_mode\": \"chat_app\", \"chat_param\": \"$APP_CODE\"}"

```
### Python
```python
from dbgpt.client import Client

DBGPT_API_KEY = "dbgpt"
client = Client(api_key=DBGPT_API_KEY)
APP_CODE="{YOUR_APP_CODE}"

async for data in client.chat_stream(
     model="chatgpt_proxyllm",
     messages="hello",
     chat_mode="chat_app", 
     chat_param=APP_CODE
    ):
        print(data)

```


# Snapshots:

Include snapshots for easier review.

# Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have already rebased the commits and make the commit message
conform to the project standard.
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] Any dependent changes have been merged and published in downstream
modules
2024-03-22 09:57:58 +08:00
Hzh_97
04322de4f3 fix(web): Fix sql format error (#1319) 2024-03-21 17:41:25 +08:00
aries_ckt
f117f4d297 fix:api_v1 msg error 2024-03-21 16:12:48 +08:00
aries_ckt
ab9d8a370e fix:return conv_uid and update wechat 2024-03-21 15:59:46 +08:00
aries_ckt
a1369c02c4 fix:client path error and update chat_knowledge prompt 2024-03-21 14:13:59 +08:00
Fangyin Cheng
b4b810d68f feat(core): Add common schemas 2024-03-21 11:23:24 +08:00
aries_ckt
75f086a41d doc:update api docs 2024-03-20 18:40:59 +08:00
aries_ckt
f43abf3155 fix:client mypy error 2024-03-20 16:22:38 +08:00
aries_ckt
4413ff682f fix:rag serve error 2024-03-18 19:37:06 +08:00
Fangyin Cheng
0ed30aa44a feat: Add dbgpt client and add api v2 2024-03-18 18:29:27 +08:00
Fangyin Cheng
4970c9f813 refactor: Refactor datasource module (#1309) 2024-03-18 18:06:40 +08:00
Fangyin Cheng
130ffb08c9 feat(model): Support yi proxy LLM (#1303) 2024-03-15 22:15:37 +08:00
6974329116 fix: Fix ClickHouse default login bug (#1292) 2024-03-15 16:47:50 +08:00
Fangyin Cheng
8897d6e8fd chore: Add pylint for storage (#1298) 2024-03-15 15:42:46 +08:00
Pete Wooden
5f3ee35804 fix: fix knowledge_space_dao.update_knowledge_space call in Knowledge… (#1250) 2024-03-04 21:54:27 +08:00
Fangyin Cheng
191f546ca4 feat: AWEL flow supports dynamic parameters (#1251) 2024-03-04 21:52:32 +08:00
Hzh_97
7a38edcaed style(web): set default knowledge icon (#1244) 2024-03-04 14:25:29 +08:00
xiuzhu9527
54ba663646 [feat] Support Hive Conn (#1215)
Co-authored-by: xiuzhu <edy@dodge-pro.local>
2024-03-03 23:50:11 +08:00
Pol Bachelin
8565f64971 fix: scheduler shutdown (#1237) 2024-03-02 21:35:00 +08:00
Fangyin Cheng
505bc32775 perf(rag): Support load large document (#1233) 2024-03-01 22:33:52 +08:00
magic.chen
ed4df23e4e fix: typo error fix (#1228) 2024-03-01 19:33:16 +08:00
katakuri
58b095d3a4 Fixes #1210 : switch strategy failed in chinese env. (#1219) 2024-03-01 10:20:05 +08:00
Fangyin Cheng
1d90711952 feat(core): Dynamically loading dbgpts (#1211) 2024-02-29 15:57:49 +08:00
Hzh_97
673ddaab5b feat(web): copy awel flow (#1200)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
2024-02-28 21:03:23 +08:00
NuoweiWang
0837da48ba Increase the accuracy of reading Excel (#1209) 2024-02-28 16:47:29 +08:00
比奇堡 扛把子
08fcb4f744 change KnowledgeQueryResponse (#1202)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
2024-02-27 11:23:25 +08:00
Hzh_97
7de98d5363 fix: sql format error (#1199) 2024-02-26 21:17:28 +08:00
katakuri
2c406feb9e feat(web): Support default strategy batch sync. (#1196) 2024-02-26 13:30:34 +08:00
Shinexy
21682575f5 Fix llm strategy store and update app/static. (#1181)
Co-authored-by: lcxadml <864255598@qq.com>
2024-02-22 14:33:57 +08:00
Fangyin Cheng
ab5e1c7ea1 feat(core): Support more chat flows (#1180) 2024-02-22 12:19:04 +08:00
lcxadml
02abcb7218 fix(web): optimize i18n name 2024-02-21 10:39:32 +08:00
明天
c78bd22fda Gpts app v0.4 (#1170) 2024-02-20 14:28:58 +08:00
lcxadml
37f7ad12cd fix: api path error (#1165) 2024-02-19 16:05:13 +08:00
明天
d5afa6e206 Native data AI application framework based on AWEL+AGENT (#1152)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
Co-authored-by: lcx01800250 <lcx01800250@alibaba-inc.com>
Co-authored-by: licunxing <864255598@qq.com>
Co-authored-by: Aralhi <xiaoping0501@gmail.com>
Co-authored-by: xuyuan23 <643854343@qq.com>
Co-authored-by: aries_ckt <916701291@qq.com>
Co-authored-by: hzh97 <2976151305@qq.com>
2024-02-07 17:43:27 +08:00
Aries-ckt
208d91dea0 fix: MySQL Database not support DDL init and upgrade. (#1133)
Co-authored-by: csunny <cfqsunny@163.com>
2024-01-30 12:09:26 +08:00
Fangyin Cheng
73c86ff083 chore: Fix package name conflict error (#1099) 2024-01-22 15:33:43 +08:00
Fangyin Cheng
2d905191f8 refactor: Refactor for core SDK (#1092) 2024-01-21 09:57:57 +08:00
Aries-ckt
0162dee474 fix(ChatKnowledge): summary support zhipu message_converter (#1085) 2024-01-18 15:09:09 +08:00
Hzh_97
0936856c3a feat: UI component rendering in agent dialog mode (#1083)
Co-authored-by: csunny <cfqsunny@163.com>
2024-01-18 11:08:02 +08:00
Fangyin Cheng
9bdb4f94b8 chore: Format agent code (#1077) 2024-01-17 10:26:48 +08:00
明天
74eb15e01c feat(agent):support chat agent scene use dbgpts (#1075) 2024-01-16 20:15:54 +08:00
Fangyin Cheng
40c853575a chore: Add pylint for DB-GPT core lib (#1076) 2024-01-16 17:36:26 +08:00
Aries-ckt
3a54d1ef9a fix:update awel embedding examples and delete unuseful code. (#1073) 2024-01-15 23:22:52 +08:00