feat: enrichers, panel de ingest y menu contextual en el grafo
- Añade enricher.go + directorio enrichers/ para enriquecer entidades con fuentes externas. - Nuevos componentes frontend: IngestPanel (panel de ingesta de datos) y NodeContextMenu (menu contextual sobre nodos del grafo). - Retira SearchBar y lib/utils.ts; la busqueda se integra dentro de los paneles existentes. - Ajusta tipos (types.go, types.ts, wailsjs/go) y theming (postcss + app.css + Mantine). - Actualiza app.go y wails.json para exponer las nuevas capacidades. - Añade directorio projects/ con estado inicial. - Rebuild del frontend (dist actualizado).
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"""Enricher: Fetch URL and produce a text node."""
|
||||
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.join(os.environ.get("FN_REGISTRY_ROOT", ""), "python", "functions", "core"))
|
||||
|
||||
from fetch_and_parse_url import fetch_and_parse_url
|
||||
|
||||
|
||||
def main():
|
||||
entity = json.load(sys.stdin)
|
||||
url = (entity.get("metadata") or {}).get("url") or entity.get("name", "")
|
||||
|
||||
if not url:
|
||||
json.dump({"error": "No URL found in entity metadata or name"}, sys.stdout)
|
||||
return
|
||||
|
||||
text = fetch_and_parse_url(url)
|
||||
|
||||
result = {
|
||||
"entities": [
|
||||
{
|
||||
"name": f"Text: {url[:60]}",
|
||||
"type_ref": "text",
|
||||
"description": f"Text extracted from {url}",
|
||||
"tags": ["extracted"],
|
||||
"metadata": {
|
||||
"content_preview": text[:500],
|
||||
"source": url,
|
||||
"char_count": len(text),
|
||||
"full_content": text,
|
||||
},
|
||||
"notes": "",
|
||||
}
|
||||
],
|
||||
"relations": [
|
||||
{
|
||||
"name": "extracted_from",
|
||||
"from_entity": "__NEW_0__",
|
||||
"to_entity": "__SOURCE__",
|
||||
"description": "Text extracted from URL",
|
||||
"weight": 1.0,
|
||||
"tags": [],
|
||||
"notes": "",
|
||||
}
|
||||
],
|
||||
}
|
||||
json.dump(result, sys.stdout, ensure_ascii=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user