You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
using AI.Models ;
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Text ;
using System.Threading ;
using System.Threading.Tasks ;
namespace AI.Interface
{
public interface IChatBackend
{
/// <summary>
/// 向模型发送自然语言请求。发给 LLM 的历史由 session.GetHistoryForLlm(guidePrompt) 从会话存储生成。
/// </summary>
/// <param name="userMessage">用户消息</param>
/// <param name="session">聊天会话。如果为 null, 将创建新的会话。</param>
/// <param name="guidePrompt">可选 System 引导词;若提供则在生成的 History 开头插入</param>
/// <param name="cancellationToken">取消令牌,用于取消请求或配合超时</param>
/// <returns>模型的响应文本</returns>
Task < string > AskAsync ( string userMessage , ChatSession ? session = null , string? guidePrompt = null , CancellationToken cancellationToken = default ) ;
/// <summary>
/// 流式向模型发送自然语言请求。发给 LLM 的历史由 session.GetHistoryForLlm(guidePrompt) 从会话存储生成。
/// </summary>
/// <param name="userMessage">用户消息</param>
/// <param name="session">聊天会话。如果为 null, 将创建新的会话。</param>
/// <param name="guidePrompt">可选 System 引导词</param>
/// <param name="cancellationToken">取消令牌,用于取消请求或配合超时</param>
/// <returns>流式返回模型的响应文本片段</returns>
IAsyncEnumerable < string > AskStreamAsync ( string userMessage , ChatSession ? session = null , string? guidePrompt = null , CancellationToken cancellationToken = default ) ;
}
}