87 lines
2.2 KiB
C#
87 lines
2.2 KiB
C#
using System;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Feature.AI;
|
|
|
|
namespace BeWo.ViewModel
|
|
{
|
|
public class AiConfigVM : AbstractDCMapperVM<AiConfigDC>
|
|
{
|
|
private AiModelDC _SelectedModel;
|
|
private float _Temperature;
|
|
private float _Top_P;
|
|
private int _Max_Gen_Len;
|
|
private AiDataContextType _Context_Type;
|
|
|
|
public AiConfigVM() : this(null) { }
|
|
public AiConfigVM(AiConfigDC dc) : base(dc, dc.Oid)
|
|
{
|
|
|
|
}
|
|
|
|
public AiModelDC SelectedModel
|
|
{
|
|
get { return _SelectedModel; }
|
|
set => SetProperty(ref _SelectedModel, value, nameof(SelectedModel), () => DataContract.SelectedModel);
|
|
}
|
|
|
|
public float Temperature
|
|
{
|
|
get { return _Temperature; }
|
|
set => SetProperty(ref _Temperature, value, nameof(Temperature), () => DataContract.Temperature);
|
|
}
|
|
|
|
public float Top_P
|
|
{
|
|
get { return _Top_P; }
|
|
set => SetProperty(ref _Top_P, value, nameof(Top_P), () => DataContract.Top_P);
|
|
}
|
|
|
|
public int Max_Gen_Len
|
|
{
|
|
get { return _Max_Gen_Len; }
|
|
set => SetProperty(ref _Max_Gen_Len, value, nameof(Max_Gen_Len), () => DataContract.Max_Gen_Len);
|
|
}
|
|
|
|
public AiDataContextType Context_Type
|
|
{
|
|
get { return _Context_Type; }
|
|
set => SetProperty(ref _Context_Type, value, nameof(Context_Type), () => DataContract.Context_Type);
|
|
}
|
|
|
|
protected override void InitByDataContract(AiConfigDC pDataContract)
|
|
{
|
|
_SelectedModel = pDataContract.SelectedModel;
|
|
_Temperature = pDataContract.Temperature;
|
|
_Top_P = pDataContract.Top_P;
|
|
_Max_Gen_Len = pDataContract.Max_Gen_Len;
|
|
_Context_Type = pDataContract.Context_Type;
|
|
}
|
|
|
|
protected override AiConfigDC MapToDataContract(AiConfigDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.SelectedModel = _SelectedModel;
|
|
pDataContract.Temperature = _Temperature;
|
|
pDataContract.Top_P = _Top_P;
|
|
pDataContract.Max_Gen_Len = _Max_Gen_Len;
|
|
pDataContract.Context_Type = _Context_Type;
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
internal void Update(AiConfigDC pDataContract)
|
|
{
|
|
DataContract = pDataContract;
|
|
|
|
SelectedModel = pDataContract.SelectedModel;
|
|
Temperature = pDataContract.Temperature;
|
|
Top_P = pDataContract.Top_P;
|
|
Max_Gen_Len = pDataContract.Max_Gen_Len;
|
|
Context_Type = pDataContract.Context_Type;
|
|
|
|
SetDirty(false);
|
|
}
|
|
}
|
|
}
|