mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Add test for CI (#3114)
### What problem does this PR solve? Add test for CI ### Type of change - [x] New Feature (non-breaking change which adds functionality) Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn>
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
import os
|
||||
from ragflow_sdk import RAGFlow
|
||||
HOST_ADDRESS = 'http://127.0.0.1:9380'
|
||||
|
||||
HOST_ADDRESS = os.getenv('HOST_ADDRESS', 'http://127.0.0.1:9380')
|
||||
|
||||
def test_create_chat_with_name(get_api_key_fixture):
|
||||
API_KEY = get_api_key_fixture
|
||||
rag = RAGFlow(API_KEY, HOST_ADDRESS)
|
||||
kb = rag.create_dataset(name="test_create_chat")
|
||||
displayed_name = "ragflow.txt"
|
||||
with open("./ragflow.txt","rb") as file:
|
||||
with open("ragflow.txt", "rb") as file:
|
||||
blob = file.read()
|
||||
document = {"displayed_name":displayed_name,"blob":blob}
|
||||
documents = []
|
||||
@ -22,7 +24,7 @@ def test_update_chat_with_name(get_api_key_fixture):
|
||||
rag = RAGFlow(API_KEY, HOST_ADDRESS)
|
||||
kb = rag.create_dataset(name="test_update_chat")
|
||||
displayed_name = "ragflow.txt"
|
||||
with open("./ragflow.txt", "rb") as file:
|
||||
with open("ragflow.txt", "rb") as file:
|
||||
blob = file.read()
|
||||
document = {"displayed_name": displayed_name, "blob": blob}
|
||||
documents = []
|
||||
@ -39,7 +41,7 @@ def test_delete_chats_with_success(get_api_key_fixture):
|
||||
rag = RAGFlow(API_KEY, HOST_ADDRESS)
|
||||
kb = rag.create_dataset(name="test_delete_chat")
|
||||
displayed_name = "ragflow.txt"
|
||||
with open("./ragflow.txt", "rb") as file:
|
||||
with open("ragflow.txt", "rb") as file:
|
||||
blob = file.read()
|
||||
document = {"displayed_name": displayed_name, "blob": blob}
|
||||
documents = []
|
||||
@ -53,9 +55,9 @@ def test_delete_chats_with_success(get_api_key_fixture):
|
||||
def test_list_chats_with_success(get_api_key_fixture):
|
||||
API_KEY = get_api_key_fixture
|
||||
rag = RAGFlow(API_KEY, HOST_ADDRESS)
|
||||
kb = rag.create_dataset(name="test_delete_chat")
|
||||
kb = rag.create_dataset(name="test_list_chats")
|
||||
displayed_name = "ragflow.txt"
|
||||
with open("./ragflow.txt", "rb") as file:
|
||||
with open("ragflow.txt", "rb") as file:
|
||||
blob = file.read()
|
||||
document = {"displayed_name": displayed_name, "blob": blob}
|
||||
documents = []
|
||||
|
||||
Reference in New Issue
Block a user