MCPcopy
hub / github.com/tickmao/Novel / _apply_existing_bonus

Method _apply_existing_bonus

scripts/source_inventory.py:201–210  ·  view source on GitHub ↗
(self, current_sources: List[Dict], candidate_sources: List[Dict])

Source from the content-addressed store, hash-verified

199 return self._sort_sources(available)[:batch_size]
200
201 def _apply_existing_bonus(self, current_sources: List[Dict], candidate_sources: List[Dict]) -> List[Dict]:
202 current_urls = {str(item.get("bookSourceUrl", "")).strip() for item in current_sources}
203 boosted: List[Dict] = []
204 for source in candidate_sources:
205 entry = deepcopy(source)
206 if str(entry.get("bookSourceUrl", "")).strip() in current_urls:
207 base = float(entry.get("selectionScore") or entry.get("score") or 0)
208 entry["selectionScore"] = round(base + 5, 2)
209 boosted.append(entry)
210 return boosted
211
212 def build_inventory(
213 self,

Callers 1

build_inventoryMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected