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 ApiKey { get; init; } = string.Empty;
|
||||||
public string Model { 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 MaxOutputTokens { get; init; } = 4000;
|
||||||
public int TimeoutSeconds { get; init; } = 120;
|
public int TimeoutSeconds { get; init; } = 120;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,11 +125,10 @@ public sealed class StoryIntelligenceClient(
|
|||||||
{
|
{
|
||||||
ApiKeyConfigured = !string.IsNullOrWhiteSpace(settings.ApiKey),
|
ApiKeyConfigured = !string.IsNullOrWhiteSpace(settings.ApiKey),
|
||||||
Model = settings.Model,
|
Model = settings.Model,
|
||||||
Temperature = settings.Temperature,
|
|
||||||
MaxOutputTokens = settings.MaxOutputTokens,
|
MaxOutputTokens = settings.MaxOutputTokens,
|
||||||
TimeoutSeconds = settings.TimeoutSeconds,
|
TimeoutSeconds = settings.TimeoutSeconds,
|
||||||
ClientConstructed = true,
|
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)
|
public async Task<StoryIntelligenceClientResult> ExecutePromptAsync(string completedPrompt, string promptVersion, CancellationToken cancellationToken)
|
||||||
@ -153,8 +152,16 @@ public sealed class StoryIntelligenceClient(
|
|||||||
{
|
{
|
||||||
model = settings.Model,
|
model = settings.Model,
|
||||||
input = completedPrompt,
|
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);
|
}, JsonOptions);
|
||||||
|
|
||||||
var stopwatch = Stopwatch.StartNew();
|
var stopwatch = Stopwatch.StartNew();
|
||||||
@ -230,8 +237,13 @@ public sealed class StoryIntelligenceClient(
|
|||||||
|
|
||||||
retryCount++;
|
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++;
|
retryCount++;
|
||||||
await DelayForRetryAsync(attempt, cancellationToken);
|
await DelayForRetryAsync(attempt, cancellationToken);
|
||||||
continue;
|
continue;
|
||||||
@ -283,7 +295,6 @@ public sealed class StoryIntelligenceDiagnosticsService(
|
|||||||
ConnectionStatus = clientStatus.ConnectionStatus,
|
ConnectionStatus = clientStatus.ConnectionStatus,
|
||||||
PromptFileName = ScenePromptFile,
|
PromptFileName = ScenePromptFile,
|
||||||
PromptVersion = versions.GetPromptVersion(ScenePromptFile),
|
PromptVersion = versions.GetPromptVersion(ScenePromptFile),
|
||||||
Temperature = clientStatus.Temperature,
|
|
||||||
MaxOutputTokens = clientStatus.MaxOutputTokens,
|
MaxOutputTokens = clientStatus.MaxOutputTokens,
|
||||||
TimeoutSeconds = clientStatus.TimeoutSeconds
|
TimeoutSeconds = clientStatus.TimeoutSeconds
|
||||||
};
|
};
|
||||||
@ -408,7 +419,6 @@ public sealed class StoryIntelligenceClientConfigurationStatus
|
|||||||
{
|
{
|
||||||
public bool ApiKeyConfigured { get; init; }
|
public bool ApiKeyConfigured { get; init; }
|
||||||
public string Model { get; init; } = string.Empty;
|
public string Model { get; init; } = string.Empty;
|
||||||
public decimal Temperature { get; init; }
|
|
||||||
public int MaxOutputTokens { get; init; }
|
public int MaxOutputTokens { get; init; }
|
||||||
public int TimeoutSeconds { get; init; }
|
public int TimeoutSeconds { get; init; }
|
||||||
public bool ClientConstructed { get; init; }
|
public bool ClientConstructed { get; init; }
|
||||||
|
|||||||
@ -81,7 +81,6 @@ public sealed class AdminDashboardViewModel
|
|||||||
public sealed class StoryIntelligenceDiagnosticsViewModel
|
public sealed class StoryIntelligenceDiagnosticsViewModel
|
||||||
{
|
{
|
||||||
public string Model { get; set; } = string.Empty;
|
public string Model { get; set; } = string.Empty;
|
||||||
public decimal Temperature { get; set; }
|
|
||||||
public int MaxOutputTokens { get; set; }
|
public int MaxOutputTokens { get; set; }
|
||||||
public int TimeoutSeconds { get; set; }
|
public int TimeoutSeconds { get; set; }
|
||||||
public bool ApiKeyConfigured { get; set; }
|
public bool ApiKeyConfigured { get; set; }
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">Admin utility</p>
|
<p class="eyebrow">Admin utility</p>
|
||||||
<h1>Story Intelligence Diagnostics</h1>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -46,13 +46,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<dl class="mt-3 mb-0">
|
<dl class="mt-3 mb-0">
|
||||||
<dt>Temperature</dt>
|
|
||||||
<dd>@Model.Temperature</dd>
|
|
||||||
<dt>Max output tokens</dt>
|
<dt>Max output tokens</dt>
|
||||||
<dd>@Model.MaxOutputTokens.ToString("N0")</dd>
|
<dd>@Model.MaxOutputTokens.ToString("N0")</dd>
|
||||||
<dt>Timeout</dt>
|
<dt>Timeout</dt>
|
||||||
<dd>@Model.TimeoutSeconds seconds</dd>
|
<dd>@Model.TimeoutSeconds seconds</dd>
|
||||||
<dt>Connection status</dt>
|
<dt>Live API status</dt>
|
||||||
<dd>@Model.ConnectionStatus</dd>
|
<dd>@Model.ConnectionStatus</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</section>
|
</section>
|
||||||
@ -95,7 +93,7 @@
|
|||||||
|
|
||||||
<section class="edit-panel">
|
<section class="edit-panel">
|
||||||
<h2>Manual dry run</h2>
|
<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>
|
<a class="btn btn-primary" asp-action="StoryIntelligenceTest">Open dry run</a>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">Admin utility</p>
|
<p class="eyebrow">Admin utility</p>
|
||||||
<h1>Story Intelligence Dry Run</h1>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<section class="edit-panel">
|
<section class="edit-panel">
|
||||||
<h2>Manual scene test</h2>
|
<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">
|
<form asp-action="StoryIntelligenceTest" method="post">
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
},
|
},
|
||||||
"OpenAI": {
|
"OpenAI": {
|
||||||
"Model": "gpt-5",
|
"Model": "gpt-5",
|
||||||
"Temperature": 0.2,
|
|
||||||
"MaxOutputTokens": 4000,
|
"MaxOutputTokens": 4000,
|
||||||
"TimeoutSeconds": 120
|
"TimeoutSeconds": 120
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user