Skip to content

Commit

Permalink
#12
Browse files Browse the repository at this point in the history
  • Loading branch information
katsumi aradono committed Jul 27, 2024
1 parent b4eacc6 commit 0679f46
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions WiseOwlChat/ChatViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ public string ModelType
string? modelName = EnumHelper.GetDescription(openAIChat.ModelType);
if (modelName == null)
{
return openAIChat.ModelType.ToString();
modelName = openAIChat.ModelType.ToString();
}
return modelName;
return modelName.Replace("-", " ");
}
set
{
foreach (MODEL_TYPE model in Enum.GetValues(typeof(MODEL_TYPE)))
{
string? modelName = EnumHelper.GetDescription(model);
if (modelName == value)
if (modelName != null && (modelName == value || modelName == value.Replace(" ", "-")))
{
openAIChat.ModelType = model;
OnPropertyChanged();
Expand All @@ -83,7 +83,7 @@ public string ModelType
}
if (Enum.TryParse<MODEL_TYPE>(value, out MODEL_TYPE mode))
{
openAIChat.ModelType = (MODEL_TYPE)mode;
openAIChat.ModelType = mode;
OnPropertyChanged();
}
}
Expand Down Expand Up @@ -254,7 +254,7 @@ public ChatViewModel()
string? modelName = EnumHelper.GetDescription(model);
if (modelName != null)
{
ModelTypeItems.Add(modelName);
ModelTypeItems.Add(modelName.Replace("-", " "));
}
}

Expand Down Expand Up @@ -411,7 +411,7 @@ private void delayedTranslation(List<Task> delayedTaskList, ConversationEntry lo
{
string instructions = "Please translate the content below into English. " + Environment.NewLine
+ "--- " + Environment.NewLine + content;
return openAIChat.SystemRequest(MODEL_TYPE.GPT_35_TURBO, false, instructions, (role) => role == ConversationEntry.ROLE_SYSTEM);
return openAIChat.SystemRequest(MODEL_TYPE.GPT_4o_mini, false, instructions, (role) => role == ConversationEntry.ROLE_SYSTEM);
})
));
}
Expand Down Expand Up @@ -484,11 +484,11 @@ private async Task query(Action update, Action<string?>? callback, string messag

if (FunctionMode)
{
string? modelName = EnumHelper.GetDescription(MODEL_TYPE.GPT_35_TURBO);
string? modelName = EnumHelper.GetDescription(MODEL_TYPE.GPT_4o_mini);
if (ModelType == modelName)
{
ModelType = modelName;
popupMessageAction("Changed MODEL_TYPE to GPT_35_TURBO_16K.");
popupMessageAction("Changed MODEL_TYPE to GPT_4o_mini_16K.");
}
}

Expand Down Expand Up @@ -616,7 +616,7 @@ private async Task _callPipeline(Action update, Action<string?>? callback, List<
{
instruction = QueryManager.Instance.ProcessInputText(instruction);
}
string? result = await openAIChat.SystemRequest(MODEL_TYPE.GPT_35_TURBO, false, instruction, null);
string? result = await openAIChat.SystemRequest(MODEL_TYPE.GPT_4o_mini, false, instruction, null);

if (direction.DirectionName != null)
{
Expand Down Expand Up @@ -648,7 +648,7 @@ private async Task _callPipeline(Action update, Action<string?>? callback, List<
if (PipelineMode)
{
await ProcessQuerysAsync(querys, false, ConversationEntry.ROLE_ASSISTANT, "");
await openAIChat.setConversationTitle(MODEL_TYPE.GPT_35_TURBO, update);
await openAIChat.setConversationTitle(MODEL_TYPE.GPT_4o_mini, update);
callback?.Invoke(null);
}
else
Expand Down Expand Up @@ -841,7 +841,7 @@ await openAIChat.SystemRequestStreamForPipeline(update,

if (index == 0)
{
await openAIChat.setConversationTitle(MODEL_TYPE.GPT_35_TURBO, update);
await openAIChat.setConversationTitle(MODEL_TYPE.GPT_4o_mini, update);
}

if (IsStop)
Expand Down Expand Up @@ -895,7 +895,7 @@ public async Task ProcessQuerysAsync(
}

string instruction = QueryManager.Instance.ProcessInputText(message.Direction);
var task = openAIChat.SystemRequest(MODEL_TYPE.GPT_35_TURBO, action == null, instruction, (role) => role == ConversationEntry.ROLE_SYSTEM);
var task = openAIChat.SystemRequest(MODEL_TYPE.GPT_4o_mini, action == null, instruction, (role) => role == ConversationEntry.ROLE_SYSTEM);
taskList.Add(task);
}

Expand Down
2 changes: 1 addition & 1 deletion WiseOwlChat/Control/ChatControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ChatControl()

modelSelector.Dispatcher.BeginInvoke(new Action(() =>
{
chatViewModel.ModelType = OpenAIChat.MODEL_TYPE.GPT_4o.ToString();
chatViewModel.ModelType = OpenAIChat.MODEL_TYPE.GPT_4o_mini.ToString();
}), DispatcherPriority.Loaded);

Instance = this;
Expand Down
12 changes: 6 additions & 6 deletions WiseOwlChat/OpenAIChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class OpenAIChat
private ConversationInfo? _conversation;
private ObservableCollection<ConversationInfo>? ConversationInfos;
private bool is_addCollection = false;
public MODEL_TYPE ModelType { get; set; } = MODEL_TYPE.GPT_4o;
public MODEL_TYPE ModelType { get; set; } = MODEL_TYPE.GPT_4o_mini;
private ForbiddenExpressionChecker forbiddenExpressionChecker = new();
public APIFunctionRegistry FunctionCallingRegistry = new();

Expand Down Expand Up @@ -49,8 +49,8 @@ public enum MODEL_TYPE
[Description("gpt-4o")]
GPT_4o,

[Description("gpt-3.5-turbo")]
GPT_35_TURBO,
[Description("gpt-4o-mini")]
GPT_4o_mini,

[Description("gpt-4-turbo")]
GPT_4_TURBO,
Expand Down Expand Up @@ -182,7 +182,7 @@ public void PartnerReflection()

return result;

}, MODEL_TYPE.GPT_35_TURBO, true, partnerReflectionGuidelines, (role) => role == ConversationEntry.ROLE_SYSTEM);
}, MODEL_TYPE.GPT_4o_mini, true, partnerReflectionGuidelines, (role) => role == ConversationEntry.ROLE_SYSTEM);
}

public void Remove(ConversationEntry conversation)
Expand Down Expand Up @@ -606,7 +606,7 @@ public bool IsFuncNameSet()
if (!is_addCollection && _conversation != null)
{
// 会話タイトルを作成
await setConversationTitle(MODEL_TYPE.GPT_35_TURBO, update);
await setConversationTitle(MODEL_TYPE.GPT_4o_mini, update);
}

callback?.Invoke(result);
Expand Down Expand Up @@ -670,7 +670,7 @@ await SendMessageStreamAsync(update, null, (msg) =>
{
_conversation.Title = msg.Split(Environment.NewLine)[0];
_conversation.ModelType = EnumHelper.GetDescription(modelType);
}, MODEL_TYPE.GPT_35_TURBO, tempRequest);
}, MODEL_TYPE.GPT_4o_mini, tempRequest);

is_addCollection = true;
}
Expand Down

0 comments on commit 0679f46

Please sign in to comment.