qfa.services.record_links#
Rewrite feedback-record mentions in LLM output as EspoCRM hyperlinks.
This is output post-processing, not prompt assembly: the LLM answers in
prose that names records by their id, and this turns those mentions
into links the analyst can click. It lives in its own module because more
than one use case needs it — the analyse result and the aggregate summary
both go back to EspoCRM — and neither of those services should have to
import the other to reach it.
Functions
|
Rewrite feedback-record-id mentions in |
- qfa.services.record_links.hyperlink_form_references(text: str, feedback_records: tuple[FeedbackRecordModel, ...], espo_feedback_base_url: str | None) str[source]#
Rewrite feedback-record-id mentions in
textas EspoCRM hyperlinks.When the analysis/summary text names a feedback record by its
id(e.g.Form-07762), rewrite that mention as[Form-07762](espo_feedback_base_url/url_id)so it renders as a clickable link back to the record in EspoCRM. No-op whenespo_feedback_base_urlis not provided; per-record no-op when that record has nourl_id. Matches on word boundaries so one record’s id cannot match as a substring of another’s (e.g.Form-1vsForm-10).