Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix propagation of ChatThreadId in ToChatResponse{Async}#5899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
stephentoub merged 1 commit intodotnet:mainfromstephentoub:bugfixes
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -89,10 +89,11 @@ static async Task<ChatResponse> ToChatResponseAsync(
/// <param name="response">The <see cref="ChatResponse"/> object whose properties should be updated based on <paramref name="update"/>.</param>
private static void ProcessUpdate(ChatResponseUpdate update, Dictionary<int, ChatMessage> messages, ChatResponse response)
{
response.ResponseId ??= update.ResponseId;
response.ChatThreadId ??= update.ChatThreadId;
response.CreatedAt ??= update.CreatedAt;
response.FinishReason ??= update.FinishReason;
response.ModelId ??= update.ModelId;
response.ResponseId ??= update.ResponseId;

#if NET
ChatMessage message = CollectionsMarshal.GetValueRefOrAddDefault(messages, update.ChoiceIndex, out _) ??=
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,7 @@ private static string GetLastSegmentFromPath(string name)
=> name.Substring(name.LastIndexOf('/') + 1);

private static string StripExtension(string name)
=> name.Substring(0, name.LastIndexOf(".", StringComparison.Ordinal));
=> name.Substring(0, name.LastIndexOf('.'));

private static (string path, bool isDir) GetResultPath(
string? executionName = null,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -426,7 +426,7 @@ private IEnumerable<OllamaChatRequestMessage> ToOllamaChatRequestMessages(ChatMe
currentTextMessage = new OllamaChatRequestMessage
{
Role = content.Role.Value,
Content = textContent.Text ?? string.Empty,
Content = textContent.Text,
};
break;

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -232,6 +232,11 @@ strictObj is bool strictValue ?
// Store the tool mode.
switch (options.ToolMode)
{
case NoneChatToolMode:
runOptions.ToolConstraint = ToolConstraint.None;
break;

case null:
case AutoChatToolMode:
runOptions.ToolConstraint = ToolConstraint.Auto;
break;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public async Task ToChatResponse_SuccessfullyCreatesResponse(bool useAsync, bool
new() { ChoiceIndex = 1, Text = "Hey", ResponseId = "12345", CreatedAt = new DateTimeOffset(1, 2, 3, 4, 5, 6, TimeSpan.Zero), ModelId = "model124" },

new() { ChoiceIndex = 0, Text = ", ", AuthorName = "Someone", Role = ChatRole.User, AdditionalProperties = new() { ["a"] = "b" } },
new() { ChoiceIndex = 1, Text = ", ", AuthorName = "Else", Role = ChatRole.System, AdditionalProperties = new() { ["g"] = "h" } },
new() { ChoiceIndex = 1, Text = ", ", AuthorName = "Else", Role = ChatRole.System,ChatThreadId = "123",AdditionalProperties = new() { ["g"] = "h" } },

new() { ChoiceIndex = 0, Text = "world!", CreatedAt = new DateTimeOffset(2, 2, 3, 4, 5, 6, TimeSpan.Zero), AdditionalProperties = new() { ["c"] = "d" } },
new() { ChoiceIndex = 1, Text = "you!", Role = ChatRole.Tool, CreatedAt = new DateTimeOffset(3, 2, 3, 4, 5, 6, TimeSpan.Zero), AdditionalProperties = new() { ["e"] = "f", ["i"] = 42 } },
Expand All@@ -69,6 +69,8 @@ public async Task ToChatResponse_SuccessfullyCreatesResponse(bool useAsync, bool
Assert.Equal(new DateTimeOffset(1, 2, 3, 4, 5, 6, TimeSpan.Zero), response.CreatedAt);
Assert.Equal("model123", response.ModelId);

Assert.Equal("123", response.ChatThreadId);

Assert.Equal(3, response.Choices.Count);

ChatMessage message = response.Choices[0];
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp