mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 20:23:36 +00:00
fix: add JSON fallback for spec generation with custom API endpoints
Fixes spec generation failure when using custom API endpoints (e.g., GLM proxy) that don't support structured output. The AI returns JSON instead of XML, but the fallback parser only looked for XML tags. Changes: - escapeXml: Handle undefined/null values gracefully (converts to empty string) - generate-spec: Add JSON extraction fallback when XML tags aren't found - Reuses existing extractJson() utility (already used for Cursor models) - Converts extracted JSON to XML using specToXml() Closes #510 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,9 +11,13 @@ export { specOutputSchema } from '@automaker/types';
|
||||
|
||||
/**
|
||||
* Escape special XML characters
|
||||
* Handles undefined/null values by converting them to empty strings
|
||||
*/
|
||||
function escapeXml(str: string): string {
|
||||
return str
|
||||
function escapeXml(str: string | undefined | null): string {
|
||||
if (str === undefined || str === null) {
|
||||
return '';
|
||||
}
|
||||
return String(str)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
|
||||
Reference in New Issue
Block a user