Corrige o fluxo Carregar DOCX → get_labels → XML SPS marcado#110
Merged
Conversation
… a partir de <article-title> se vier vazio.
…d em lista (Gemini); usa stream_data no front matter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O que esse PR faz?
Corrige o fluxo Marcação editorial → Carregar DOCX →
get_labels→ XML SPS marcado, que quebrava ou concluía sem artefactos utilizáveis.Extração DOCX (
markuplib/function_docx.py)if not obj_image:perdido num merge (is_numPr,paragraph, listas).&e<no texto das células de tabela (html.escape); renomeia variável localhtml→table_htmlpara não sombrear o módulohtml.Marcação e XML (
markup_doc/labeling_utils.py,xml.py)escape_angle_brackets_outside_tags— parágrafos comp < 0.05deixam de quebrarappend_fragment.sanitize_table_html_fragment/parse_xml_fragment— tabelas com&ou<nas células.sanitize_inline_xml_fragment— listas com caracteres especiais.normalize_aff_ids—affidvindo do Gemini como lista gera vários<xref ref-type="aff">.iter_front_blocks—get_xmlusa o front recém-gerado (stream_data), não só o StreamField já persistido.article-metaquando não há bloco translate-front; proteção em keywords (vals2).Task Celery (
markup_doc/tasks.py,wagtail_hooks.py)get_labels(article_id, user_id)— localiza o registo por pk (evita falha com título em branco ou duplicado).persist_article_xml— gravatext_xml,file_xmle estado Processed.apply_document_title_from_article_title— preenche Document Title a partir do bloco<article-title>quando o upload vem sem título.LLM (
model_ai/llama.py)Testes (
markup_doc/tests.py)affid, título,iter_front_blocks,get_xml,persist_article_xml.Onde a revisão poderia começar?
markup_doc/tasks.py—get_labels,persist_article_xml, final do pipeline.markuplib/function_docx.py—extractContent/extrae_Tabla(~linhas 220–330 e blocoif not obj_image).markup_doc/labeling_utils.py—append_fragment,sanitize_*,apply_document_title_from_article_title.markup_doc/xml.py—iter_front_blocks, blococontrib/aff, parse de tabelas.Como este poderia ser testado manualmente?
docker compose -f local.yml up -d django celeryworker.docxde teste sem preencher Document Title (ex.:fixtures/review-article/fixture_review_article_en.docx).text_xmlpreenchido; link Download XML.<article-title>presente.docker logs markapi_local_celeryworker --tail 80— procurarget_labels iniciado,LLM: GEMINI,Chamando Gemini,XML gravado.docker compose -f local.yml run --rm django pytest markup_doc/tests.py -v(27 testes)Algum cenário de contexto que queira dar?
get_labelsneste PR; o ZIP inclui PDF apenas se existirem renditions configuradas noutro fluxo (generate_zipcomrenditions=[]por defeito).update_xml).llama-cpp-python; Gemini é o backend LLM esperado.Screenshots
N/A
Quais são tickets relevantes?
N/A