Explorar el Código

Fix: citation issue. (#9424)

### What problem does this PR solve?

#8474

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.20.2
Kevin Hu hace 2 meses
padre
commit
22915223d4
No account linked to committer's email address
Se han modificado 1 ficheros con 2 adiciones y 9 borrados
  1. 2
    9
      api/apps/conversation_app.py

+ 2
- 9
api/apps/conversation_app.py Ver fichero

if not e: if not e:
return get_data_error_result(message="Dialog not found") return get_data_error_result(message="Dialog not found")
conv = {"id": conv_id, "dialog_id": req["dialog_id"], "name": name, "message": [{"role": "assistant", "content": dia.prompt_config["prologue"]}],"user_id": current_user.id, conv = {"id": conv_id, "dialog_id": req["dialog_id"], "name": name, "message": [{"role": "assistant", "content": dia.prompt_config["prologue"]}],"user_id": current_user.id,
"reference":[{}],}
"reference":[],}
ConversationService.save(**conv) ConversationService.save(**conv)
return get_json_result(data=conv) return get_json_result(data=conv)
except Exception as e: except Exception as e:


if not conv.reference: if not conv.reference:
conv.reference = [] conv.reference = []
else:
for ref in conv.reference:
if isinstance(ref, list):
continue
ref["chunks"] = chunks_format(ref)

if not conv.reference:
conv.reference = []
conv.reference = [r for r in conv.reference if r]
conv.reference.append({"chunks": [], "doc_aggs": []}) conv.reference.append({"chunks": [], "doc_aggs": []})


def stream(): def stream():

Cargando…
Cancelar
Guardar