mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: save team's canvas issue. (#9518)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -67,9 +67,17 @@ class CodeExecParam(ToolParamBase):
|
|||||||
"description": """
|
"description": """
|
||||||
This tool has a sandbox that can execute code written in 'Python'/'Javascript'. It recieves a piece of code and return a Json string.
|
This tool has a sandbox that can execute code written in 'Python'/'Javascript'. It recieves a piece of code and return a Json string.
|
||||||
Here's a code example for Python(`main` function MUST be included):
|
Here's a code example for Python(`main` function MUST be included):
|
||||||
def main(arg1: str, arg2: str) -> dict:
|
def main() -> dict:
|
||||||
|
\"\"\"
|
||||||
|
Generate Fibonacci numbers within 100.
|
||||||
|
\"\"\"
|
||||||
|
def fibonacci_recursive(n):
|
||||||
|
if n <= 1:
|
||||||
|
return n
|
||||||
|
else:
|
||||||
|
return fibonacci_recursive(n-1) + fibonacci_recursive(n-2)
|
||||||
return {
|
return {
|
||||||
"result": arg1 + arg2,
|
"result": fibonacci_recursive(100),
|
||||||
}
|
}
|
||||||
|
|
||||||
Here's a code example for Javascript(`main` function MUST be included and exported):
|
Here's a code example for Javascript(`main` function MUST be included and exported):
|
||||||
|
|||||||
@ -74,11 +74,11 @@ def rm():
|
|||||||
@login_required
|
@login_required
|
||||||
def save():
|
def save():
|
||||||
req = request.json
|
req = request.json
|
||||||
req["user_id"] = current_user.id
|
|
||||||
if not isinstance(req["dsl"], str):
|
if not isinstance(req["dsl"], str):
|
||||||
req["dsl"] = json.dumps(req["dsl"], ensure_ascii=False)
|
req["dsl"] = json.dumps(req["dsl"], ensure_ascii=False)
|
||||||
req["dsl"] = json.loads(req["dsl"])
|
req["dsl"] = json.loads(req["dsl"])
|
||||||
if "id" not in req:
|
if "id" not in req:
|
||||||
|
req["user_id"] = current_user.id
|
||||||
if UserCanvasService.query(user_id=current_user.id, title=req["title"].strip()):
|
if UserCanvasService.query(user_id=current_user.id, title=req["title"].strip()):
|
||||||
return get_data_error_result(message=f"{req['title'].strip()} already exists.")
|
return get_data_error_result(message=f"{req['title'].strip()} already exists.")
|
||||||
req["id"] = get_uuid()
|
req["id"] = get_uuid()
|
||||||
|
|||||||
@ -57,7 +57,7 @@ async def run_graphrag(
|
|||||||
):
|
):
|
||||||
chunks.append(d["content_with_weight"])
|
chunks.append(d["content_with_weight"])
|
||||||
|
|
||||||
with trio.fail_after(len(chunks)*60):
|
with trio.fail_after(max(120, len(chunks)*120)):
|
||||||
subgraph = await generate_subgraph(
|
subgraph = await generate_subgraph(
|
||||||
LightKGExt
|
LightKGExt
|
||||||
if "method" not in row["kb_parser_config"].get("graphrag", {}) or row["kb_parser_config"]["graphrag"]["method"] != "general"
|
if "method" not in row["kb_parser_config"].get("graphrag", {}) or row["kb_parser_config"]["graphrag"]["method"] != "general"
|
||||||
|
|||||||
@ -302,7 +302,7 @@ async def build_chunks(task, progress_callback):
|
|||||||
# If the image is in RGBA mode, convert it to RGB mode before saving it in JPEG format.
|
# If the image is in RGBA mode, convert it to RGB mode before saving it in JPEG format.
|
||||||
if d["image"].mode in ("RGBA", "P"):
|
if d["image"].mode in ("RGBA", "P"):
|
||||||
converted_image = d["image"].convert("RGB")
|
converted_image = d["image"].convert("RGB")
|
||||||
d["image"].close() # Close original image
|
#d["image"].close() # Close original image
|
||||||
d["image"] = converted_image
|
d["image"] = converted_image
|
||||||
try:
|
try:
|
||||||
d["image"].save(output_buffer, format='JPEG')
|
d["image"].save(output_buffer, format='JPEG')
|
||||||
|
|||||||
Reference in New Issue
Block a user