| | | 1 | | namespace NexusLabs.Needlr.Copilot; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents a citation from a Copilot web search result, linking a |
| | | 5 | | /// span of the answer text to a source URL. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <remarks> |
| | | 8 | | /// <see cref="StartIndex"/> and <see cref="EndIndex"/> are character offsets |
| | | 9 | | /// into <see cref="WebSearchResult.Text"/> exactly as returned by the API. |
| | | 10 | | /// They correspond to the <c>【3:N†source】</c> markers in the raw text. |
| | | 11 | | /// </remarks> |
| | | 12 | | public sealed class WebSearchCitation |
| | | 13 | | { |
| | 8 | 14 | | internal WebSearchCitation( |
| | 8 | 15 | | string title, |
| | 8 | 16 | | string url, |
| | 8 | 17 | | int startIndex, |
| | 8 | 18 | | int endIndex) |
| | | 19 | | { |
| | 8 | 20 | | Title = title; |
| | 8 | 21 | | Url = url; |
| | 8 | 22 | | StartIndex = startIndex; |
| | 8 | 23 | | EndIndex = endIndex; |
| | 8 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// The title of the cited source page. |
| | | 28 | | /// </summary> |
| | 6 | 29 | | public string Title { get; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// The URL of the cited source. |
| | | 33 | | /// </summary> |
| | 1 | 34 | | public string Url { get; } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// The start character offset (inclusive) in |
| | | 38 | | /// <see cref="WebSearchResult.Text"/> where this citation marker appears. |
| | | 39 | | /// </summary> |
| | 3 | 40 | | public int StartIndex { get; } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// The end character offset (exclusive) in |
| | | 44 | | /// <see cref="WebSearchResult.Text"/> where this citation marker ends. |
| | | 45 | | /// </summary> |
| | 2 | 46 | | public int EndIndex { get; } |
| | | 47 | | } |