KevinHuSh
commited on
Commit
·
66d1750
1
Parent(s):
0e3c0e9
make sure to raise exception if redis is not there (#674)
Browse files### What problem does this PR solve?
### Type of change
- [x] Refactoring
- api/apps/llm_app.py +10 -0
- api/db/services/task_service.py +1 -1
api/apps/llm_app.py
CHANGED
|
@@ -142,6 +142,16 @@ def add_llm():
|
|
| 142 |
return get_json_result(data=True)
|
| 143 |
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
@manager.route('/my_llms', methods=['GET'])
|
| 146 |
@login_required
|
| 147 |
def my_llms():
|
|
|
|
| 142 |
return get_json_result(data=True)
|
| 143 |
|
| 144 |
|
| 145 |
+
@manager.route('/delete_llm', methods=['POST'])
|
| 146 |
+
@login_required
|
| 147 |
+
@validate_request("llm_factory", "llm_name")
|
| 148 |
+
def delete_llm():
|
| 149 |
+
req = request.json
|
| 150 |
+
TenantLLMService.filter_delete(
|
| 151 |
+
[TenantLLM.tenant_id == current_user.id, TenantLLM.llm_factory == req["llm_factory"], TenantLLM.llm_name == req["llm_name"]])
|
| 152 |
+
return get_json_result(data=True)
|
| 153 |
+
|
| 154 |
+
|
| 155 |
@manager.route('/my_llms', methods=['GET'])
|
| 156 |
@login_required
|
| 157 |
def my_llms():
|
api/db/services/task_service.py
CHANGED
|
@@ -159,4 +159,4 @@ def queue_tasks(doc, bucket, name):
|
|
| 159 |
DocumentService.begin2parse(doc["id"])
|
| 160 |
|
| 161 |
for t in tsks:
|
| 162 |
-
REDIS_CONN.queue_product(SVR_QUEUE_NAME, message=t)
|
|
|
|
| 159 |
DocumentService.begin2parse(doc["id"])
|
| 160 |
|
| 161 |
for t in tsks:
|
| 162 |
+
assert REDIS_CONN.queue_product(SVR_QUEUE_NAME, message=t), "Can't access Redis. Please check the Redis' status."
|