Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(service): fix bug for doc type in encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Larryjianfeng committed Sep 2, 2019
1 parent a252024 commit ba21c4e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gnes/service/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ def embed_chunks_in_docs(self, docs: Union[List['gnes_pb2.Document'], 'gnes_pb2.
for c in d.chunks:
if d.doc_type == gnes_pb2.Document.TEXT:
contents.append(c.text)
else:
elif d.doc_type in {gnes_pb2.Document.IMAGE, gnes_pb2.Document.VIDEO}:
contents.append(blob2array(c.blob))
else:
self.logger.warning(
'chunk content is in type: %s, dont kow how to handle that, ignored' % c.WhichOneof('content'))

if do_encoding:
embeds = self._model.encode(contents)
Expand Down

0 comments on commit ba21c4e

Please sign in to comment.