Pārlūkot izejas kodu

fix #8424 NPE in dify_retrieval.py, add log exception (#9212)

### What problem does this PR solve?

fix #8424 NPE in dify_retrieval.py, add log exception

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.20.1
Jay Xu pirms 3 mēnešiem
vecāks
revīzija
83aca2d07b
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4
    1
      api/apps/sdk/dify_retrieval.py

+ 4
- 1
api/apps/sdk/dify_retrieval.py Parādīt failu

# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
import logging

from flask import request, jsonify from flask import request, jsonify


from api.db import LLMType from api.db import LLMType
"content": c["content_with_weight"], "content": c["content_with_weight"],
"score": c["similarity"], "score": c["similarity"],
"title": c["docnm_kwd"], "title": c["docnm_kwd"],
"metadata": doc.meta_fields
"metadata": getattr(doc, 'meta_fields', {})
}) })


return jsonify({"records": records}) return jsonify({"records": records})
message='No chunk found! Check the chunk status please!', message='No chunk found! Check the chunk status please!',
code=settings.RetCode.NOT_FOUND code=settings.RetCode.NOT_FOUND
) )
logging.exception(e)
return build_error_result(message=str(e), code=settings.RetCode.SERVER_ERROR) return build_error_result(message=str(e), code=settings.RetCode.SERVER_ERROR)

Notiek ielāde…
Atcelt
Saglabāt