fix(api): rename 'metadata' to 'response_metadata' to avoid Pydantic conflict
The field name 'metadata' conflicts with Pydantic's internal ClassVar. Renamed to 'response_metadata' throughout: - Backend: RoutineSuggestion, BatchSuggestion, ShoppingSuggestionResponse - Frontend: TypeScript types and component usages This fixes the AttributeError when setting metadata on SQLModel instances.
This commit is contained in:
parent
d00e0afeec
commit
c8fa80be99
20 changed files with 3802 additions and 23 deletions
|
|
@ -263,7 +263,7 @@ export interface RoutineSuggestion {
|
|||
// Phase 3: Observability fields
|
||||
validation_warnings?: string[];
|
||||
auto_fixes_applied?: string[];
|
||||
metadata?: ResponseMetadata;
|
||||
response_metadata?: ResponseMetadata;
|
||||
}
|
||||
|
||||
export interface DayPlan {
|
||||
|
|
@ -279,7 +279,7 @@ export interface BatchSuggestion {
|
|||
// Phase 3: Observability fields
|
||||
validation_warnings?: string[];
|
||||
auto_fixes_applied?: string[];
|
||||
metadata?: ResponseMetadata;
|
||||
response_metadata?: ResponseMetadata;
|
||||
}
|
||||
|
||||
// ─── Shopping suggestion types ───────────────────────────────────────────────
|
||||
|
|
@ -300,7 +300,7 @@ export interface ShoppingSuggestionResponse {
|
|||
// Phase 3: Observability fields
|
||||
validation_warnings?: string[];
|
||||
auto_fixes_applied?: string[];
|
||||
metadata?: ResponseMetadata;
|
||||
response_metadata?: ResponseMetadata;
|
||||
}
|
||||
|
||||
// ─── Health types ────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
// Phase 3: Observability state
|
||||
let validationWarnings = $state<string[] | undefined>(undefined);
|
||||
let autoFixes = $state<string[] | undefined>(undefined);
|
||||
let metadata = $state<ResponseMetadata | undefined>(undefined);
|
||||
let responseMetadata = $state<ResponseMetadata | undefined>(undefined);
|
||||
|
||||
function enhanceForm() {
|
||||
loading = true;
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
// Phase 3: Extract observability data
|
||||
validationWarnings = result.data.validation_warnings as string[] | undefined;
|
||||
autoFixes = result.data.auto_fixes_applied as string[] | undefined;
|
||||
metadata = result.data.metadata as ResponseMetadata | undefined;
|
||||
responseMetadata = result.data.response_metadata as ResponseMetadata | undefined;
|
||||
errorMsg = null;
|
||||
} else if (result.type === 'failure') {
|
||||
errorMsg = (result.data?.error as string) ?? m["suggest_errorDefault"]();
|
||||
|
|
@ -93,11 +93,11 @@
|
|||
{#if validationWarnings}
|
||||
<ValidationWarningsAlert warnings={validationWarnings} />
|
||||
{/if}
|
||||
{#if metadata?.reasoning_chain}
|
||||
<ReasoningChainViewer reasoningChain={metadata.reasoning_chain} />
|
||||
{#if responseMetadata?.reasoning_chain}
|
||||
<ReasoningChainViewer reasoningChain={responseMetadata.reasoning_chain} />
|
||||
{/if}
|
||||
{#if metadata}
|
||||
<MetadataDebugPanel {metadata} />
|
||||
{#if responseMetadata}
|
||||
<MetadataDebugPanel metadata={responseMetadata} />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -227,11 +227,11 @@
|
|||
{#if suggestion.validation_warnings}
|
||||
<ValidationWarningsAlert warnings={suggestion.validation_warnings} />
|
||||
{/if}
|
||||
{#if suggestion.metadata?.reasoning_chain}
|
||||
<ReasoningChainViewer reasoningChain={suggestion.metadata.reasoning_chain} />
|
||||
{#if suggestion.response_metadata?.reasoning_chain}
|
||||
<ReasoningChainViewer reasoningChain={suggestion.response_metadata.reasoning_chain} />
|
||||
{/if}
|
||||
{#if suggestion.metadata}
|
||||
<MetadataDebugPanel metadata={suggestion.metadata} />
|
||||
{#if suggestion.response_metadata}
|
||||
<MetadataDebugPanel metadata={suggestion.response_metadata} />
|
||||
{/if}
|
||||
|
||||
<!-- Steps -->
|
||||
|
|
@ -349,11 +349,11 @@
|
|||
{#if batch.validation_warnings}
|
||||
<ValidationWarningsAlert warnings={batch.validation_warnings} />
|
||||
{/if}
|
||||
{#if batch.metadata?.reasoning_chain}
|
||||
<ReasoningChainViewer reasoningChain={batch.metadata.reasoning_chain} />
|
||||
{#if batch.response_metadata?.reasoning_chain}
|
||||
<ReasoningChainViewer reasoningChain={batch.response_metadata.reasoning_chain} />
|
||||
{/if}
|
||||
{#if batch.metadata}
|
||||
<MetadataDebugPanel metadata={batch.metadata} />
|
||||
{#if batch.response_metadata}
|
||||
<MetadataDebugPanel metadata={batch.response_metadata} />
|
||||
{/if}
|
||||
|
||||
<!-- Day cards -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue