patch annotations
This commit is contained in:
parent
349e58eee8
commit
70477fdcd9
|
|
@ -66,6 +66,7 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
{
|
{
|
||||||
CurrentAgentId = agent.Id,
|
CurrentAgentId = agent.Id,
|
||||||
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
||||||
|
ToolCallId = toolCall?.Id,
|
||||||
FunctionName = toolCall?.FunctionName,
|
FunctionName = toolCall?.FunctionName,
|
||||||
FunctionArgs = toolCall?.FunctionArguments?.ToString(),
|
FunctionArgs = toolCall?.FunctionArguments?.ToString(),
|
||||||
RenderedInstruction = string.Join("\r\n", renderedInstructions)
|
RenderedInstruction = string.Join("\r\n", renderedInstructions)
|
||||||
|
|
@ -83,7 +84,14 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
{
|
{
|
||||||
CurrentAgentId = agent.Id,
|
CurrentAgentId = agent.Id,
|
||||||
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
||||||
RenderedInstruction = string.Join("\r\n", renderedInstructions)
|
RenderedInstruction = string.Join("\r\n", renderedInstructions),
|
||||||
|
Annotations = value.Annotations?.Select(x => new ChatAnnotation
|
||||||
|
{
|
||||||
|
Title = x.WebResourceTitle,
|
||||||
|
Url = x.WebResourceUri.AbsoluteUri,
|
||||||
|
StartIndex = x.StartIndex,
|
||||||
|
EndIndex = x.EndIndex
|
||||||
|
})?.ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -201,6 +209,19 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Text response received
|
// Text response received
|
||||||
|
msg = new RoleDialogModel(AgentRole.Assistant, text)
|
||||||
|
{
|
||||||
|
CurrentAgentId = agent.Id,
|
||||||
|
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
||||||
|
RenderedInstruction = string.Join("\r\n", renderedInstructions),
|
||||||
|
Annotations = value.Annotations?.Select(x => new ChatAnnotation
|
||||||
|
{
|
||||||
|
Title = x.WebResourceTitle,
|
||||||
|
Url = x.WebResourceUri.AbsoluteUri,
|
||||||
|
StartIndex = x.StartIndex,
|
||||||
|
EndIndex = x.EndIndex
|
||||||
|
})?.ToList()
|
||||||
|
};
|
||||||
await onMessageReceived(msg);
|
await onMessageReceived(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,14 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
{
|
{
|
||||||
CurrentAgentId = agent.Id,
|
CurrentAgentId = agent.Id,
|
||||||
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
||||||
RenderedInstruction = string.Join("\r\n", renderedInstructions)
|
RenderedInstruction = string.Join("\r\n", renderedInstructions),
|
||||||
|
Annotations = value.Annotations?.Select(x => new ChatAnnotation
|
||||||
|
{
|
||||||
|
Title = x.WebResourceTitle,
|
||||||
|
Url = x.WebResourceUri.AbsoluteUri,
|
||||||
|
StartIndex = x.StartIndex,
|
||||||
|
EndIndex = x.EndIndex
|
||||||
|
})?.ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,6 +178,19 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Text response received
|
// Text response received
|
||||||
|
msg = new RoleDialogModel(AgentRole.Assistant, text)
|
||||||
|
{
|
||||||
|
CurrentAgentId = agent.Id,
|
||||||
|
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
||||||
|
RenderedInstruction = string.Join("\r\n", renderedInstructions),
|
||||||
|
Annotations = value.Annotations?.Select(x => new ChatAnnotation
|
||||||
|
{
|
||||||
|
Title = x.WebResourceTitle,
|
||||||
|
Url = x.WebResourceUri.AbsoluteUri,
|
||||||
|
StartIndex = x.StartIndex,
|
||||||
|
EndIndex = x.EndIndex
|
||||||
|
})?.ToList()
|
||||||
|
};
|
||||||
await onMessageReceived(msg);
|
await onMessageReceived(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,19 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Text response received
|
// Text response received
|
||||||
|
msg = new RoleDialogModel(AgentRole.Assistant, text)
|
||||||
|
{
|
||||||
|
CurrentAgentId = agent.Id,
|
||||||
|
MessageId = conversations.LastOrDefault()?.MessageId ?? string.Empty,
|
||||||
|
RenderedInstruction = string.Join("\r\n", renderedInstructions),
|
||||||
|
Annotations = value.Annotations?.Select(x => new ChatAnnotation
|
||||||
|
{
|
||||||
|
Title = x.WebResourceTitle,
|
||||||
|
Url = x.WebResourceUri.AbsoluteUri,
|
||||||
|
StartIndex = x.StartIndex,
|
||||||
|
EndIndex = x.EndIndex
|
||||||
|
})?.ToList()
|
||||||
|
};
|
||||||
await onMessageReceived(msg);
|
await onMessageReceived(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue