Phase 20J Fix
This commit is contained in:
parent
406dae8bd7
commit
d2c1841853
@ -69,7 +69,6 @@ public sealed class StoryIntelligenceOptions
|
||||
{
|
||||
public string ApiKey { get; init; } = string.Empty;
|
||||
public string Model { get; init; } = string.Empty;
|
||||
public decimal Temperature { get; init; } = 0.2m;
|
||||
public int MaxOutputTokens { get; init; } = 4000;
|
||||
public int TimeoutSeconds { get; init; } = 120;
|
||||
}
|
||||
|
||||
@ -125,11 +125,10 @@ public sealed class StoryIntelligenceClient(
|
||||
{
|
||||
ApiKeyConfigured = !string.IsNullOrWhiteSpace(settings.ApiKey),
|
||||
Model = settings.Model,
|
||||
Temperature = settings.Temperature,
|
||||
MaxOutputTokens = settings.MaxOutputTokens,
|
||||
TimeoutSeconds = settings.TimeoutSeconds,
|
||||
ClientConstructed = true,
|
||||
ConnectionStatus = "Not checked. Diagnostics do not call OpenAI."
|
||||
ConnectionStatus = "Not checked on diagnostics page. Only the admin dry-run page makes a live OpenAI request."
|
||||
};
|
||||
|
||||
public async Task<StoryIntelligenceClientResult> ExecutePromptAsync(string completedPrompt, string promptVersion, CancellationToken cancellationToken)
|
||||
@ -153,8 +152,16 @@ public sealed class StoryIntelligenceClient(
|
||||
{
|
||||
model = settings.Model,
|
||||
input = completedPrompt,
|
||||
temperature = settings.Temperature,
|
||||
max_output_tokens = settings.MaxOutputTokens
|
||||
max_output_tokens = settings.MaxOutputTokens,
|
||||
store = false,
|
||||
reasoning = new
|
||||
{
|
||||
effort = "minimal"
|
||||
},
|
||||
text = new
|
||||
{
|
||||
verbosity = "low"
|
||||
}
|
||||
}, JsonOptions);
|
||||
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
@ -230,8 +237,13 @@ public sealed class StoryIntelligenceClient(
|
||||
|
||||
retryCount++;
|
||||
}
|
||||
catch (TaskCanceledException) when (!cancellationToken.IsCancellationRequested && attempt < maxAttempts)
|
||||
catch (TaskCanceledException) when (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
if (attempt == maxAttempts)
|
||||
{
|
||||
throw new InvalidOperationException($"OpenAI request timed out after {settings.TimeoutSeconds} seconds.");
|
||||
}
|
||||
|
||||
retryCount++;
|
||||
await DelayForRetryAsync(attempt, cancellationToken);
|
||||
continue;
|
||||
@ -283,7 +295,6 @@ public sealed class StoryIntelligenceDiagnosticsService(
|
||||
ConnectionStatus = clientStatus.ConnectionStatus,
|
||||
PromptFileName = ScenePromptFile,
|
||||
PromptVersion = versions.GetPromptVersion(ScenePromptFile),
|
||||
Temperature = clientStatus.Temperature,
|
||||
MaxOutputTokens = clientStatus.MaxOutputTokens,
|
||||
TimeoutSeconds = clientStatus.TimeoutSeconds
|
||||
};
|
||||
@ -408,7 +419,6 @@ public sealed class StoryIntelligenceClientConfigurationStatus
|
||||
{
|
||||
public bool ApiKeyConfigured { get; init; }
|
||||
public string Model { get; init; } = string.Empty;
|
||||
public decimal Temperature { get; init; }
|
||||
public int MaxOutputTokens { get; init; }
|
||||
public int TimeoutSeconds { get; init; }
|
||||
public bool ClientConstructed { get; init; }
|
||||
|
||||
@ -81,7 +81,6 @@ public sealed class AdminDashboardViewModel
|
||||
public sealed class StoryIntelligenceDiagnosticsViewModel
|
||||
{
|
||||
public string Model { get; set; } = string.Empty;
|
||||
public decimal Temperature { get; set; }
|
||||
public int MaxOutputTokens { get; set; }
|
||||
public int TimeoutSeconds { get; set; }
|
||||
public bool ApiKeyConfigured { get; set; }
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<div>
|
||||
<p class="eyebrow">Admin utility</p>
|
||||
<h1>Story Intelligence Diagnostics</h1>
|
||||
<p class="lead-text">Configuration and prompt loading checks. This page does not call OpenAI.</p>
|
||||
<p class="lead-text">Build and configuration checks only. This page does not make a live OpenAI request.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -46,13 +46,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<dl class="mt-3 mb-0">
|
||||
<dt>Temperature</dt>
|
||||
<dd>@Model.Temperature</dd>
|
||||
<dt>Max output tokens</dt>
|
||||
<dd>@Model.MaxOutputTokens.ToString("N0")</dd>
|
||||
<dt>Timeout</dt>
|
||||
<dd>@Model.TimeoutSeconds seconds</dd>
|
||||
<dt>Connection status</dt>
|
||||
<dt>Live API status</dt>
|
||||
<dd>@Model.ConnectionStatus</dd>
|
||||
</dl>
|
||||
</section>
|
||||
@ -95,7 +93,7 @@
|
||||
|
||||
<section class="edit-panel">
|
||||
<h2>Manual dry run</h2>
|
||||
<p>This admin-only tool loads the prompt, substitutes test scene data and performs a live OpenAI call without saving data.</p>
|
||||
<p>This admin-only tool performs live API verification by loading the prompt, substituting test scene data and making one OpenAI request with extraction-focused settings. It does not save data.</p>
|
||||
<a class="btn btn-primary" asp-action="StoryIntelligenceTest">Open dry run</a>
|
||||
</section>
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<div>
|
||||
<p class="eyebrow">Admin utility</p>
|
||||
<h1>Story Intelligence Dry Run</h1>
|
||||
<p class="lead-text">This is a development dry run. It does not save data or modify projects.</p>
|
||||
<p class="lead-text">This is a development dry run. It makes one live OpenAI extraction request only when submitted, and it does not save data or modify projects.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
<section class="edit-panel">
|
||||
<h2>Manual scene test</h2>
|
||||
<p>Use short fictional sample text only. This page loads <code>Scene-Prompt-V1.md</code>, replaces runtime placeholders, and displays the raw response.</p>
|
||||
<p>Use short fictional sample text only. This page loads <code>Scene-Prompt-V1.md</code>, replaces runtime placeholders, makes a live extraction request when submitted, and displays the raw response without parsing or saving it.</p>
|
||||
<form asp-action="StoryIntelligenceTest" method="post">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3">
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
},
|
||||
"OpenAI": {
|
||||
"Model": "gpt-5",
|
||||
"Temperature": 0.2,
|
||||
"MaxOutputTokens": 4000,
|
||||
"TimeoutSeconds": 120
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user