Add Chinese covers and source-bound library edition metadata
This commit is contained in:
@@ -74,6 +74,10 @@ async def run(args):
|
||||
'total': len(entries), 'pending_batches': len(batches), 'batch_files': [f'{i:04d}.json' for i in range(len(batches))]})
|
||||
print(f'Prepared {len(entries)} complete-book units; {len(batches)} pending batches; {work}')
|
||||
return
|
||||
if args.action == 'build' and getattr(args, 'edition_config', None):
|
||||
from src.edition.localize import validate_config_assets
|
||||
for mode in ('target_only', 'bilingual'):
|
||||
validate_config_assets(args.source, args.edition_config, mode)
|
||||
structure = verify_source(args.source, work)
|
||||
metadata = json.loads((work/'agent-run.json').read_text())
|
||||
if metadata['model'] != args.model:
|
||||
@@ -114,7 +118,10 @@ async def run(args):
|
||||
for mode, prefix in [('target_only', 'translated_'), ('bilingual', 'bilingual_')]:
|
||||
copy = structure.model_copy(deep=True)
|
||||
await BackfillEngine().backfill(copy, entries, mode=mode)
|
||||
BilingualBuilder(work, args.source).build(copy, output/(prefix+args.source.name))
|
||||
built = BilingualBuilder(work, args.source).build(copy, output/(prefix+args.source.name))
|
||||
if getattr(args, 'edition_config', None):
|
||||
from src.edition.localize import localize_from_config
|
||||
localize_from_config(built, args.edition_config, mode)
|
||||
save(work/'translation-provenance.json', {'model': args.model, 'source_sha256': structure.source_sha256,
|
||||
'total': len(entries), 'accepted': len(entries), 'provider': 'agent-authored manifest'})
|
||||
print(f'Built both full-book modes: {len(entries)}/{len(entries)}; {output}')
|
||||
@@ -124,6 +131,7 @@ def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('action', choices=['prepare', 'apply', 'build']); parser.add_argument('source', type=Path)
|
||||
parser.add_argument('--work', required=True, type=Path); parser.add_argument('--result', type=Path)
|
||||
parser.add_argument('--edition-config', type=Path)
|
||||
parser.add_argument('--glossary', type=Path); parser.add_argument('--output-dir', type=Path)
|
||||
parser.add_argument('--model', default='agent/luna'); parser.add_argument('--batch-chars', type=int, default=16000)
|
||||
args = parser.parse_args()
|
||||
|
||||
Reference in New Issue
Block a user