mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
make sure the models will not be load twice (#422)
### What problem does this PR solve? #381 ### Type of change - [x] Refactoring
This commit is contained in:
@ -105,8 +105,8 @@ def stats():
|
||||
res = {
|
||||
"pv": [(o["dt"], o["pv"]) for o in objs],
|
||||
"uv": [(o["dt"], o["uv"]) for o in objs],
|
||||
"speed": [(o["dt"], o["tokens"]/o["duration"]) for o in objs],
|
||||
"tokens": [(o["dt"], o["tokens"]/1000.) for o in objs],
|
||||
"speed": [(o["dt"], float(o["tokens"])/float(o["duration"])) for o in objs],
|
||||
"tokens": [(o["dt"], float(o["tokens"])/1000.) for o in objs],
|
||||
"round": [(o["dt"], o["round"]) for o in objs],
|
||||
"thumb_up": [(o["dt"], o["thumb_up"]) for o in objs]
|
||||
}
|
||||
@ -115,8 +115,7 @@ def stats():
|
||||
return server_error_response(e)
|
||||
|
||||
|
||||
@manager.route('/new_conversation', methods=['POST'])
|
||||
@validate_request("user_id")
|
||||
@manager.route('/new_conversation', methods=['GET'])
|
||||
def set_conversation():
|
||||
token = request.headers.get('Authorization').split()[1]
|
||||
objs = APIToken.query(token=token)
|
||||
@ -131,7 +130,7 @@ def set_conversation():
|
||||
conv = {
|
||||
"id": get_uuid(),
|
||||
"dialog_id": dia.id,
|
||||
"user_id": req["user_id"],
|
||||
"user_id": request.args.get("user_id", ""),
|
||||
"message": [{"role": "assistant", "content": dia.prompt_config["prologue"]}]
|
||||
}
|
||||
API4ConversationService.save(**conv)
|
||||
|
||||
@ -629,7 +629,7 @@ class Document(DataBaseModel):
|
||||
max_length=128,
|
||||
null=False,
|
||||
default="local",
|
||||
help_text="where dose this document from")
|
||||
help_text="where dose this document come from")
|
||||
type = CharField(max_length=32, null=False, help_text="file extension")
|
||||
created_by = CharField(
|
||||
max_length=32,
|
||||
|
||||
Reference in New Issue
Block a user