Skip to content

Commit 009d2ff

Browse files
committed
Enhance OpenAIService to include user messages for O-series models in chat interactions
1 parent c4b678d commit 009d2ff

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/DesktopApp/ImageToPose.Core/Services/IOpenAIService.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,13 @@ public async Task<PoseRig> GenerateRigAsync(string extendedPoseText, Cancellatio
335335
var replacement = $"POSE_TEXT_START{Environment.NewLine}{extendedPoseText}{Environment.NewLine}POSE_TEXT_END";
336336
var prompt = Regex.Replace(promptTemplate, pattern, replacement, RegexOptions.IgnoreCase);
337337

338+
// O-series and other models all support system + user message pattern
339+
// System message contains the instructions, user message triggers generation
338340
var messages = new List<ChatMessage>
339-
{
340-
new SystemChatMessage(prompt)
341-
};
341+
{
342+
new SystemChatMessage(prompt),
343+
new UserChatMessage("Generate the rig following the instructions above.")
344+
};
342345

343346
var chat = client.GetChatClient(model);
344347
var temperature = 0.2f;
@@ -461,6 +464,8 @@ private async Task<bool> ProbeChatAsync(OpenAIClient root, string model, Cancell
461464
{
462465
// small backoff loop around a one-token-ish probe
463466
var chat = root.GetChatClient(model);
467+
468+
// O-series models require a user message (not just system)
464469
var msgs = new[] { new UserChatMessage("ping") };
465470
var delays = new[] { 250, 500, 1000 }; // ms
466471

0 commit comments

Comments
 (0)