Files
BeWoPlaner/AiCoreUnitTest/Ollama2FacadeTest.cs
2026-03-09 13:51:33 +01:00

54 lines
1.1 KiB
C#

using AICore.Facade.LLM;
using BeWo.Service.Core;
using BS.Shared.Core;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace AiCoreUnitTest
{
[TestClass]
public class Ollama2FacadeTest
{
public OllamaApiClient Client { get; set; }
[TestInitialize]
public void TestInitialize()
{
var url = "https://ai3.ownsoft.de";
var key = "mu9ZPuUXJ4aVGLU1WL2RfPCeSMRmJREwyjVJBP7bHfSz8quZRqN7e7UwnwCDi8GZ";
Client = new OllamaApiClient(url, key, BS.Shared.AiModelSource.ollama2);
}
[TestMethod]
public void GetModels()
{
var response = Client.GetAiModelle();
Assert.IsTrue(response?.Success);
}
[TestMethod]
public void SendMessage()
{
var logger = ServiceLogger.GetRequestLogger(out string id);
// Build Payload
var payload = new
{
model = "gemma3:12b",
messages = new[] {
new {
role = "user",
message = "why is the sky blue?"
}
},
requestid = id
};
var response = Client.SendAiMessageRequest(payload, out string message, out string model, out int? duration, logger);
Assert.IsTrue(response?.Success);
}
}
}