microsoft / microsoft/teams-sdk

[Feature Request]: Add 'url' field to citations constructed during sayCommand function execution

Open
#2,015 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement JS
Dominant language
TypeScript
Stars
729
Forks
270
Avg merge
2d 4h
Merged PRs (30d)
19

Description

Scenario

When I use azure_search data source which adds citations to the bot's response in Teams, the added citations do not come with links to the sources. When the citation objects are initially returned by gpt-4o, they do include a url field, but that field is not carried over to the bot's response that is constructed in the sayCommand function (as seen in actions/SayCommand.js, lines 32-41). For this reason, the user cannot go back to the sources that the bot bases its answer on, and the bot therefore cannot double as a smart search engine. This is a pity because it otherwise has the capacity for it.

Solution

The solution would be to add the url field to the clientCitation object construction in lib/actions/SayCommand.js, lines 32-41, i.e. turn block A into block B:

Block A

const clientCitation = {
    '@type': 'Claim',
    position: `${i + 1}`,
    appearance: {
        '@type': 'DigitalDocument',
        name: citation.title || `Document #${i + 1}`,
        abstract: Utilities_1.Utilities.snippet(citation.content, 500)
    }
};

Block B

const clientCitation = {
    '@type': 'Claim',
    position: `${i + 1}`,
    appearance: {
        '@type': 'DigitalDocument',
        name: citation.title || `Document #${i + 1}`,
        abstract: Utilities_1.Utilities.snippet(citation.content, 500),
        url: citation.url
    }
};

I made the change temporarily on my local machine to see what would happen, and surprisingly, I did not even need to make changes to the bot's code to fetch the urls from the citations and add them to the message, the urls appeared in the bot's messages by themselves, once the url field was added to the clientCitation objects in the sayCommand function, as seen in Image A which is taken prior to adding the url field and Image B which is taken after:

Image A: Without url
image

Image B: With url
image

I haven't found the block of code in the library that is responsible for making the links appear in the bot's message autmatically.

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/actions/SayCommand.js at the clientCitation construction around lines 32-41 and trace how citation fields are carried into the bot response. Preserve the source URL in the citation output, then verify that Azure Search citations expose their links in Teams messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
api, backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.