// Some copyright should be here...
using UnrealBuildTool;
public class furcraHomeAIServerChat2 : ModuleRules
{
public furcraHomeAIServerChat2(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core", "CoreUObject", "Engine", "UMG","HTTP", "Json", "JsonUtilities"
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"DeveloperSettings",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
// Fill out your copyright notice in the Description page of Project Settings.
#include "AiChatTypes.h"
AiChatTypes::AiChatTypes()
{
}
AiChatTypes::~AiChatTypes()
{
}
AiLinkAsyncChat.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintAsyncActionBase.h"
#include "AiChatTypes.h"
#include "AiLinkAsyncChat.generated.h"
// Forward declarations for HTTP interfaces to avoid including HTTP headers in this public header
class IHttpRequest;
class IHttpResponse;
using FHttpRequestPtr = TSharedPtr<IHttpRequest, ESPMode::ThreadSafe>;
using FHttpResponsePtr = TSharedPtr<IHttpResponse, ESPMode::ThreadSafe>;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAiChatSuccess, const FString&, AssistantText);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAiChatError, const FString&, Error);
UCLASS()
class FURCRAHOMEAISERVERCHAT2_API UAiLinkAsyncChat : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintAssignable) FAiChatSuccess OnSuccess;
UPROPERTY(BlueprintAssignable) FAiChatError OnError;
// Messagesは「system + 履歴 + 今回のuser」を含めて渡す
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"))
static UAiLinkAsyncChat* SendChat(const TArray<FAiChatMessage>& Messages);
virtual void Activate() override;
private:
TArray<FAiChatMessage> MessagesInternal;
void HandleResponse(FHttpRequestPtr Req, FHttpResponsePtr Resp, bool bOk);
};
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
/**
*
*/
class FURCRAHOMEAISERVERCHAT2_API AiLinkRequestTypes
{
public:
AiLinkRequestTypes();
~AiLinkRequestTypes();
};
//#pragma once
//#include "CoreMinimal.h"
#include "AiLinkRequestTypes.generated.h"
USTRUCT()
struct FOllamaGenerateRequest
{
GENERATED_BODY()
UPROPERTY() FString model;
UPROPERTY() FString prompt;
UPROPERTY() bool stream = false;
};
USTRUCT()
struct FOllamaGenerateResponse
{
GENERATED_BODY()
UPROPERTY() FString response;
UPROPERTY() bool done = false;
};
AiLinkRequestTypes.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "AiLinkRequestTypes.h"
AiLinkRequestTypes::AiLinkRequestTypes()
{
}
AiLinkRequestTypes::~AiLinkRequestTypes()
{
}
UAiLinkSettings.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/DeveloperSettings.h"
#include "UAiLinkSettings.generated.h"
UCLASS(Config = Game, DefaultConfig, meta = (DisplayName = "Home AI Chat"))
class FURCRAHOMEAISERVERCHAT2_API UAiLinkSettings : public UDeveloperSettings
{
GENERATED_BODY()
public:
UPROPERTY(Config, EditAnywhere, Category = "AI")
FString BaseUrl = TEXT("http://192.168.1.23:11434");
UPROPERTY(Config, EditAnywhere, Category = "AI")
//FString Model = TEXT("llama3.1");
//FString Model = TEXT("deepseek-r1:32b");llama3.1:8b
//FString Model = TEXT("llama3.1:70b");//llama3.1:8b
FString Model = TEXT("llama3.1:8b");//
UPROPERTY(Config, EditAnywhere, Category = "AI")
float TimeoutSeconds = 120.0f;
// 例: "You are NPC assistant in my game..."
UPROPERTY(Config, EditAnywhere, Category = "AI")
FString SystemPrompt = TEXT("You are a helpful in-game NPC. Keep replies concise.");
};
UAiLinkSettings.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "UAiLinkSettings.h"
Failed to compile plugin source code. See output log for more information.
プラグインのソースコードをコンパイルできませんでした。詳細は出力ログを参照してください。
‘furcraeaUEOpenAI2’ already defines a member called ‘furcraeaUEOpenAI2’ with the same parameter types Expecting to find a type to be declared in a target rules named ‘furcraeaUEOpenAI2EditorTarget’. This type must derive from the ‘TargetRules’ type defined by UnrealBuildTool.
Boostの仕上げ方は Set Max Engine Torque でやった。通常500にしてブースト時10000にして差をつけた。10000以上にするとトルク(時間当たりのねじり力)が強すぎて車体が左右ブレするのは少しならいいんだが、完全にぶれて曲がってしまう様子。 500トルクでは200KM/hぐらいだが10000トルクでは270KM/hぐらいまで加速できるようになる。
Boost中にタイヤがロックしてしまう問題があったが、ブーストモーションにキーがはいっていたのが問題だと思ったが+Wheelの動きとBoostのモーションをLayered Blend Per Boneでブレンドして解決した。