Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions TelegramSearchBot.Common/Attributes/McpAttributes.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;

namespace TelegramSearchBot.Attributes
{
namespace TelegramSearchBot.Attributes {
/// <summary>
/// Marks a method as a tool that can be called by the LLM.
/// Deprecated: Use <see cref="BuiltInToolAttribute"/> instead for built-in tools.
Expand All @@ -19,7 +18,7 @@
/// </summary>
public string Name { get; set; }

public McpToolAttribute(string description) {

Check warning on line 21 in TelegramSearchBot.Common/Attributes/McpAttributes.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Non-nullable property 'Name' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
Description = description;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool IsIterationLimitMessage(string content) {
/// 在累积内容末尾追加标记
/// </summary>
public static string AppendMarker(string accumulatedContent) {
return (accumulatedContent ?? string.Empty) + Marker;
return ( accumulatedContent ?? string.Empty ) + Marker;
}

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions TelegramSearchBot.Common/Model/Tools/SendDocumentResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace TelegramSearchBot.Model.Tools {
public class SendDocumentResult {
public bool Success { get; set; }
public int? MessageId { get; set; }
public long ChatId { get; set; }
public string Error { get; set; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "*SendDocumentResult.cs" -o -name "*SendVideoResult.cs" | head -20

Repository: ModerRAS/TelegramSearchBot

Length of output: 188


🏁 Script executed:

cat -n "./TelegramSearchBot.Common/Model/Tools/SendDocumentResult.cs"

Repository: ModerRAS/TelegramSearchBot

Length of output: 382


🏁 Script executed:

cat -n "./TelegramSearchBot.Common/Model/Tools/SendVideoResult.cs"

Repository: ModerRAS/TelegramSearchBot

Length of output: 379


🏁 Script executed:

find . -type f -name "*.cs" | xargs grep -l "SendDocumentResult" | head -10

Repository: ModerRAS/TelegramSearchBot

Length of output: 255


🏁 Script executed:

find . -type f -name "*.cs" | xargs grep -l "SendVideoResult" | head -10

Repository: ModerRAS/TelegramSearchBot

Length of output: 246


🏁 Script executed:

cat -n "./TelegramSearchBot/Service/Tools/SendDocumentToolService.cs"

Repository: ModerRAS/TelegramSearchBot

Length of output: 5422


🏁 Script executed:

cat -n "./TelegramSearchBot/Service/Tools/SendVideoToolService.cs"

Repository: ModerRAS/TelegramSearchBot

Length of output: 5375


Make Error nullable.

Error is only populated on failures, so keeping it non-nullable gives consumers the wrong contract and produces nullable noise.

🩹 Proposed fix
-        public string Error { get; set; }
+        public string? Error { get; set; }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public string Error { get; set; }
public string? Error { get; set; }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@TelegramSearchBot.Common/Model/Tools/SendDocumentResult.cs` at line 6, The
Error property on SendDocumentResult should be nullable because it only exists
for failures; change the property declaration of SendDocumentResult.Error from
string to string? and update any callers (creators/readers of
SendDocumentResult) to handle potential null (e.g., checks for null before using
Error or use null-coalescing where appropriate). Ensure any serialization
attributes or DTO mappings still allow null values for Error.

}
}
8 changes: 8 additions & 0 deletions TelegramSearchBot.Common/Model/Tools/SendVideoResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace TelegramSearchBot.Model.Tools {
public class SendVideoResult {
public bool Success { get; set; }
public int? MessageId { get; set; }
public long ChatId { get; set; }
public string Error { get; set; }

Check warning on line 6 in TelegramSearchBot.Common/Model/Tools/SendVideoResult.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Non-nullable property 'Error' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 6 in TelegramSearchBot.Common/Model/Tools/SendVideoResult.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Non-nullable property 'Error' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the SendVideoResult.cs file
find . -name "SendVideoResult.cs" -type f

Repository: ModerRAS/TelegramSearchBot

Length of output: 127


🏁 Script executed:

# Let's also search for SendVideoToolService to understand the usage context
find . -name "*SendVideoToolService*" -type f

Repository: ModerRAS/TelegramSearchBot

Length of output: 188


🏁 Script executed:

# Search for how Error property is set/used
rg "SendVideoResult" -t cs -A 3 -B 3

Repository: ModerRAS/TelegramSearchBot

Length of output: 5610


🏁 Script executed:

# Let's examine the complete SendVideoResult.cs file
cat -n ./TelegramSearchBot.Common/Model/Tools/SendVideoResult.cs

Repository: ModerRAS/TelegramSearchBot

Length of output: 379


🏁 Script executed:

# Let's also check the complete SendVideoToolService.SendVideoFile method to see all success/error paths
cat -n ./TelegramSearchBot/Service/Tools/SendVideoToolService.cs | sed -n '1,100p'

Repository: ModerRAS/TelegramSearchBot

Length of output: 5366


🏁 Script executed:

# Check for any port-related code in SendVideoResult.cs (coding guideline check)
rg "Port|port|:|\d{4,5}" ./TelegramSearchBot.Common/Model/Tools/SendVideoResult.cs

Repository: ModerRAS/TelegramSearchBot

Length of output: 52


Make Error nullable.

Successful results don't set this property (lines 87-91 in SendVideoToolService.SendVideoFile), so the current contract is misleading and triggers nullable reference type warnings.

🩹 Proposed fix
-        public string Error { get; set; }
+        public string? Error { get; set; }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public string Error { get; set; }
public string? Error { get; set; }
🧰 Tools
🪛 GitHub Check: build (ubuntu-latest)

[warning] 6-6:
Non-nullable property 'Error' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@TelegramSearchBot.Common/Model/Tools/SendVideoResult.cs` at line 6, The Error
property on the SendVideoResult model should be nullable to reflect that
successful results leave it unset; update the declaration of Error in class
SendVideoResult to a nullable string (e.g., string? Error { get; set; }) and
adjust any callers or consumers if they assume non-null (notably
SendVideoToolService.SendVideoFile where success paths do not set Error), so
nullable-reference warnings are eliminated and the contract accurately
represents optional error data.

}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TelegramSearchBot.Migrations
{
namespace TelegramSearchBot.Migrations {
/// <inheritdoc />
public partial class AddUserWithGroupUniqueIndex : Migration
{
public partial class AddUserWithGroupUniqueIndex : Migration {
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
protected override void Up(MigrationBuilder migrationBuilder) {
migrationBuilder.CreateIndex(
name: "IX_UsersWithGroup_UserId_GroupId",
table: "UsersWithGroup",
Expand All @@ -18,8 +15,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
protected override void Down(MigrationBuilder migrationBuilder) {
migrationBuilder.DropIndex(
name: "IX_UsersWithGroup_UserId_GroupId",
table: "UsersWithGroup");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TelegramSearchBot.Migrations
{
namespace TelegramSearchBot.Migrations {
/// <inheritdoc />
public partial class AddChannelWithModelIsDeleted : Migration
{
public partial class AddChannelWithModelIsDeleted : Migration {
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
protected override void Up(MigrationBuilder migrationBuilder) {
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "ChannelsWithModel",
Expand All @@ -19,8 +16,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
protected override void Down(MigrationBuilder migrationBuilder) {
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "ChannelsWithModel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,20 @@ public async Task GetChannelsAsync_NoModels_ReturnsEmpty() {
public async Task GetChannelsAsync_WithModel_ReturnsOrderedChannels() {
// Arrange
var channel1 = new LLMChannel {
Name = "ch1", Gateway = "gw1", ApiKey = "key1",
Provider = LLMProvider.OpenAI, Parallel = 2, Priority = 1
Name = "ch1",
Gateway = "gw1",
ApiKey = "key1",
Provider = LLMProvider.OpenAI,
Parallel = 2,
Priority = 1
};
var channel2 = new LLMChannel {
Name = "ch2", Gateway = "gw2", ApiKey = "key2",
Provider = LLMProvider.OpenAI, Parallel = 3, Priority = 10
Name = "ch2",
Gateway = "gw2",
ApiKey = "key2",
Provider = LLMProvider.OpenAI,
Parallel = 3,
Priority = 10
};
_dbContext.LLMChannels.AddRange(channel1, channel2);
await _dbContext.SaveChangesAsync();
Expand All @@ -130,7 +138,10 @@ public async Task GetChannelsAsync_WithModel_ReturnsOrderedChannels() {
public async Task ExecAsync_NoModelConfigured_YieldsNoResults() {
// Arrange - no group settings configured
var message = new TelegramSearchBot.Model.Data.Message {
Content = "test", GroupId = 123, MessageId = 1, FromUserId = 1
Content = "test",
GroupId = 123,
MessageId = 1,
FromUserId = 1
};

// Act
Expand All @@ -153,8 +164,12 @@ public async Task GetAvailableCapacityAsync_NoChannels_ReturnsZero() {
public async Task GetAvailableCapacityAsync_WithChannels_ReturnsCapacity() {
// Arrange
var channel = new LLMChannel {
Name = "ch1", Gateway = "gw1", ApiKey = "key1",
Provider = LLMProvider.OpenAI, Parallel = 5, Priority = 1
Name = "ch1",
Gateway = "gw1",
ApiKey = "key1",
Provider = LLMProvider.OpenAI,
Parallel = 5,
Priority = 1
};
_dbContext.LLMChannels.Add(channel);
await _dbContext.SaveChangesAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ public async Task GetModelCapabilities_NotFound_ReturnsNull() {
public async Task GetModelCapabilities_WithCapabilities_ReturnsCorrectModel() {
// Arrange
var channel = new LLMChannel {
Name = "test", Gateway = "gw", ApiKey = "key",
Provider = LLMProvider.OpenAI, Parallel = 1, Priority = 1
Name = "test",
Gateway = "gw",
ApiKey = "key",
Provider = LLMProvider.OpenAI,
Parallel = 1,
Priority = 1
};
_dbContext.LLMChannels.Add(channel);
await _dbContext.SaveChangesAsync();
Expand Down Expand Up @@ -106,8 +110,12 @@ public async Task GetModelCapabilities_WithCapabilities_ReturnsCorrectModel() {
public async Task GetToolCallingSupportedModels_ReturnsCorrectModels() {
// Arrange
var channel = new LLMChannel {
Name = "test", Gateway = "gw", ApiKey = "key",
Provider = LLMProvider.OpenAI, Parallel = 1, Priority = 1
Name = "test",
Gateway = "gw",
ApiKey = "key",
Provider = LLMProvider.OpenAI,
Parallel = 1,
Priority = 1
};
_dbContext.LLMChannels.Add(channel);
await _dbContext.SaveChangesAsync();
Expand Down Expand Up @@ -138,7 +146,7 @@ public async Task GetToolCallingSupportedModels_ReturnsCorrectModels() {
await _dbContext.SaveChangesAsync();

// Act
var result = (await _service.GetToolCallingSupportedModels()).ToList();
var result = ( await _service.GetToolCallingSupportedModels() ).ToList();

// Assert
Assert.Single(result);
Expand All @@ -149,8 +157,12 @@ public async Task GetToolCallingSupportedModels_ReturnsCorrectModels() {
public async Task GetVisionSupportedModels_ReturnsCorrectModels() {
// Arrange
var channel = new LLMChannel {
Name = "test", Gateway = "gw", ApiKey = "key",
Provider = LLMProvider.OpenAI, Parallel = 1, Priority = 1
Name = "test",
Gateway = "gw",
ApiKey = "key",
Provider = LLMProvider.OpenAI,
Parallel = 1,
Priority = 1
};
_dbContext.LLMChannels.Add(channel);
await _dbContext.SaveChangesAsync();
Expand All @@ -170,7 +182,7 @@ public async Task GetVisionSupportedModels_ReturnsCorrectModels() {
await _dbContext.SaveChangesAsync();

// Act
var result = (await _service.GetVisionSupportedModels()).ToList();
var result = ( await _service.GetVisionSupportedModels() ).ToList();

// Assert
Assert.Single(result);
Expand All @@ -181,8 +193,12 @@ public async Task GetVisionSupportedModels_ReturnsCorrectModels() {
public async Task GetEmbeddingModels_ReturnsCorrectModels() {
// Arrange
var channel = new LLMChannel {
Name = "test", Gateway = "gw", ApiKey = "key",
Provider = LLMProvider.OpenAI, Parallel = 1, Priority = 1
Name = "test",
Gateway = "gw",
ApiKey = "key",
Provider = LLMProvider.OpenAI,
Parallel = 1,
Priority = 1
};
_dbContext.LLMChannels.Add(channel);
await _dbContext.SaveChangesAsync();
Expand All @@ -202,7 +218,7 @@ public async Task GetEmbeddingModels_ReturnsCorrectModels() {
await _dbContext.SaveChangesAsync();

// Act
var result = (await _service.GetEmbeddingModels()).ToList();
var result = ( await _service.GetEmbeddingModels() ).ToList();

// Assert
Assert.Single(result);
Expand All @@ -213,8 +229,12 @@ public async Task GetEmbeddingModels_ReturnsCorrectModels() {
public async Task CleanupOldCapabilities_RemovesOldEntries() {
// Arrange
var channel = new LLMChannel {
Name = "test", Gateway = "gw", ApiKey = "key",
Provider = LLMProvider.OpenAI, Parallel = 1, Priority = 1
Name = "test",
Gateway = "gw",
ApiKey = "key",
Provider = LLMProvider.OpenAI,
Parallel = 1,
Priority = 1
};
_dbContext.LLMChannels.Add(channel);
await _dbContext.SaveChangesAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void SerializeProviderHistory_WithToolCallHistory_PreservesContent() {
};

var serialized = OpenAIService.SerializeProviderHistory(history);

Assert.Equal(5, serialized.Count);
Assert.Contains("tool_call", serialized[2].Content);
Assert.Contains("bash", serialized[3].Content);
Expand Down
9 changes: 4 additions & 5 deletions TelegramSearchBot.LLM/Service/AI/LLM/McpToolHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static string RegisterToolsAndGetPromptString(List<Assembly> assemblies)
var builtInParamAttr = param.GetCustomAttribute<BuiltInParameterAttribute>();
var mcpParamAttr = param.GetCustomAttribute<McpParameterAttribute>();
var paramDescription = builtInParamAttr?.Description ?? mcpParamAttr?.Description ?? $"Parameter '{param.Name}'";
var paramIsRequired = builtInParamAttr?.IsRequired ?? mcpParamAttr?.IsRequired ?? (!param.IsOptional && !param.HasDefaultValue);
var paramIsRequired = builtInParamAttr?.IsRequired ?? mcpParamAttr?.IsRequired ?? ( !param.IsOptional && !param.HasDefaultValue );
var paramType = MapToJsonSchemaType(param.ParameterType);

properties[param.Name] = new Dictionary<string, object> {
Expand Down Expand Up @@ -518,7 +518,7 @@ private static (string toolName, Dictionary<string, string> arguments) ParseTool
}
}

if (toolName == null || (!ToolRegistry.ContainsKey(toolName) && !ExternalToolRegistry.ContainsKey(toolName))) {
if (toolName == null || ( !ToolRegistry.ContainsKey(toolName) && !ExternalToolRegistry.ContainsKey(toolName) )) {
_sLogger?.LogWarning($"ParseToolElement: Unregistered tool '{element.Name.LocalName}'");
return (null, null);
}
Expand Down Expand Up @@ -713,8 +713,7 @@ public static async Task<object> ExecuteRegisteredToolAsync(string toolName, Dic

if (result is Task taskResult) {
await taskResult;
if (taskResult.GetType().IsGenericType)
{
if (taskResult.GetType().IsGenericType) {
return ( ( dynamic ) taskResult ).Result;
}
return null;
Expand Down Expand Up @@ -910,7 +909,7 @@ public static void RegisterExternalMcpTools(Interface.Mcp.IMcpServerManager mcpS
RegisterExternalTools(
toolInfos,
async (serverName, toolName, arguments) => {
var objectArgs = arguments.ToDictionary(kvp => kvp.Key, kvp => (object)kvp.Value);
var objectArgs = arguments.ToDictionary(kvp => kvp.Key, kvp => ( object ) kvp.Value);
var result = await mcpServerManager.CallToolAsync(serverName, toolName, objectArgs);
if (result.IsError) {
return $"Error: {string.Join("\n", result.Content?.Select(c => c.Text ?? "") ?? Enumerable.Empty<string>())}";
Expand Down
6 changes: 3 additions & 3 deletions TelegramSearchBot.LLM/Service/AI/LLM/OpenAIService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,10 @@ private static bool IsToolCallingNotSupportedError(Exception ex) {
}
}
// Common error patterns when a model/API doesn't support tool calling
return message.Contains("tools", StringComparison.OrdinalIgnoreCase) &&
(message.Contains("not supported", StringComparison.OrdinalIgnoreCase) ||
return message.Contains("tools", StringComparison.OrdinalIgnoreCase) &&
( message.Contains("not supported", StringComparison.OrdinalIgnoreCase) ||
message.Contains("unsupported", StringComparison.OrdinalIgnoreCase) ||
message.Contains("invalid", StringComparison.OrdinalIgnoreCase)) ||
message.Contains("invalid", StringComparison.OrdinalIgnoreCase) ) ||
message.Contains("unrecognized request argument", StringComparison.OrdinalIgnoreCase);
}

Expand Down
2 changes: 1 addition & 1 deletion TelegramSearchBot.LLM/Service/Mcp/McpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private async Task CleanupProcessAsync() {
_process.Kill(true);
// Wait briefly for the process to actually exit
try {
_process.WaitForExit(ProcessExitTimeoutMs);
_process.WaitForExit(ProcessExitTimeoutMs);
} catch { }
}
} catch { }
Expand Down
4 changes: 2 additions & 2 deletions TelegramSearchBot.LLM/Service/Mcp/McpServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private async Task DisconnectServerAsync(string serverName) {
if (_clients.TryRemove(serverName, out var client)) {
try {
await client.DisconnectAsync();
(client as IDisposable)?.Dispose();
( client as IDisposable )?.Dispose();
} catch (Exception ex) {
_logger.LogWarning(ex, "Error disconnecting MCP server '{Name}'", serverName);
}
Expand Down Expand Up @@ -293,7 +293,7 @@ public async Task ShutdownAllAsync() {
public void Dispose() {
foreach (var kvp in _clients) {
try {
(kvp.Value as IDisposable)?.Dispose();
( kvp.Value as IDisposable )?.Dispose();
} catch { }
}
_clients.Clear();
Expand Down
6 changes: 3 additions & 3 deletions TelegramSearchBot.LLM/Service/Tools/FileToolService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private static string ResolvePath(string path) {
private static int CountOccurrences(string text, string pattern) {
int count = 0;
int index = 0;
while ((index = text.IndexOf(pattern, index, StringComparison.Ordinal)) != -1) {
while (( index = text.IndexOf(pattern, index, StringComparison.Ordinal) ) != -1) {
count++;
index += pattern.Length;
}
Expand All @@ -296,8 +296,8 @@ private static int CountOccurrences(string text, string pattern) {
private static string FormatFileSize(long bytes) {
if (bytes < 1024) return $"{bytes}B";
if (bytes < 1024 * 1024) return $"{bytes / 1024.0:F1}KB";
if (bytes < 1024 * 1024 * 1024) return $"{bytes / (1024.0 * 1024):F1}MB";
return $"{bytes / (1024.0 * 1024 * 1024):F1}GB";
if (bytes < 1024 * 1024 * 1024) return $"{bytes / ( 1024.0 * 1024 ):F1}MB";
return $"{bytes / ( 1024.0 * 1024 * 1024 ):F1}GB";
}
}
}
4 changes: 2 additions & 2 deletions TelegramSearchBot.Test/Helper/WordCloudHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void GenerateWordCloud_ShouldCreateImageFile() {
// 打印文件路径
System.Console.WriteLine($"词云图片已保存到: {Path.GetFullPath(outputPath)}");
} catch (Exception ex) when (ex is System.DllNotFoundException ||
(ex is System.TypeInitializationException tex &&
tex.InnerException is System.PlatformNotSupportedException or System.DllNotFoundException)) {
( ex is System.TypeInitializationException tex &&
tex.InnerException is System.PlatformNotSupportedException or System.DllNotFoundException )) {
// 在Linux上GDI+不可用时跳过测试(包括libgdiplus未安装或平台不支持)
System.Console.WriteLine($"跳过测试:{ex.Message}");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ await _botClient.EditMessageReplyMarkup(
List<Model.Data.Message> sentMessagesForDb = await _sendMessageService.SendDraftStream(
resumeStream,
snapshot.ChatId,
snapshot.OriginalMessageId,
( int ) snapshot.OriginalMessageId,
initialContent,
CancellationToken.None
);
Expand Down Expand Up @@ -198,7 +198,7 @@ await _botClient.SendMessage(
snapshot.ChatId,
$"⚠️ AI 再次达到最大迭代次数限制({Env.MaxToolCycles} 次),已完成 {executionContext.SnapshotData.CyclesSoFar} 次循环,是否继续迭代?",
replyMarkup: keyboard,
replyParameters: new ReplyParameters { MessageId = snapshot.OriginalMessageId }
replyParameters: new ReplyParameters { MessageId = ( int ) snapshot.OriginalMessageId }
);
}
} finally {
Expand Down
2 changes: 1 addition & 1 deletion TelegramSearchBot/Extension/ServiceCollectionExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
using TelegramSearchBot.Executor;
using TelegramSearchBot.Helper;
using TelegramSearchBot.Interface;
using TelegramSearchBot.Interface.AI.LLM;
using TelegramSearchBot.Interface.Controller;
using TelegramSearchBot.Manager;
using TelegramSearchBot.Model;
using TelegramSearchBot.Search.Tool;
using TelegramSearchBot.Interface.AI.LLM;
using TelegramSearchBot.Service.BotAPI;
using TelegramSearchBot.Service.Storage;
using TelegramSearchBot.View;
Expand Down
Loading
Loading