This commit is contained in:
Jicheng Lu 2024-05-10 22:05:06 -05:00
commit 5c751b68d2
4 changed files with 15 additions and 9 deletions

View file

@ -8,13 +8,18 @@ public class ElementButton
public string Type { get; set; } = "web_url";
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string Url { get; set; }
public string? Url { get; set; }
[Translate]
public string Title { get; set; } = string.Empty;
[JsonPropertyName("description")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string Payload { get; set; }
[Translate]
public string? Description { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Payload { get; set; }
[JsonPropertyName("is_primary")]
public bool IsPrimary { get; set; }

View file

@ -52,9 +52,9 @@ public partial class ConversationService
message.Files?.Clear();
// Save payload
if (replyMessage != null)
if (replyMessage != null && !string.IsNullOrEmpty(replyMessage.Payload))
{
message.Payload = string.IsNullOrEmpty(replyMessage.Payload) ? message.Content : replyMessage.Payload;
message.Payload = replyMessage.Payload;
}
// Before chat completion hook

View file

@ -61,9 +61,11 @@ public class TranslationService : ITranslationService
{
// Override language if it's Unknown, it's used to output the corresponding language.
var states = _services.GetRequiredService<IConversationStateService>();
var inputLanguage = string.IsNullOrEmpty(translatedStringList.InputLanguage) ? LanguageType.ENGLISH : translatedStringList.InputLanguage;
var languageState = states.GetState("language", inputLanguage);
states.SetState("language", languageState, activeRounds: 1);
if (!states.ContainsState("language"))
{
var inputLanguage = string.IsNullOrEmpty(translatedStringList.InputLanguage) ? LanguageType.ENGLISH : translatedStringList.InputLanguage;
states.SetState("language", inputLanguage, activeRounds: 1);
}
var translatedTexts = translatedStringList.Texts;
var map = new Dictionary<string, string>();

View file

@ -9,5 +9,4 @@ Next action agent is inferred based on user lastest response.
Expected user goal agent is {{ expected_user_goal_agent }}.
{%- else -%}
User goal agent is inferred based on user initial request.
{%- endif %}
Detect language based on the overall content in [CONVERSATION] and only include user message.
{%- endif %}