mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
- Bug B1-B7: media UI m.kind||m.type, serviceKinds, gemini mediaPriority, schema kind, models/info lookup by kind - Dead code D1-D6: safeParseJSON, drop PROVIDER_ENDPOINTS, orphan fetcher, GITHUB_CONFIG derive, getProviderConfig internal, legacy kiro file - Translator concerns: toOpenAIUsage, toOpenAIFinish (gemini/kiro/ollama + fix kiro tool finish), thinking effort maps - Reorg helpers/ → concerns/ (logic) + formats/ (per-format) + schema/ (pure enums: roles/blocks/finishReasons/defaults) - Wire ~280 hardcoded role/block/finish/default literals to schema enums across 20+ files - collapseTextParts + extractTextContent dedup - Normalize translator fn names to openaiToXRequest / xToOpenAIResponse - Golden tests lock behavior; 0 regression (byte-for-byte providers/alias, 26=26 known fails) Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
// Content-block "type" discriminators — fixed per format. Pure data (no logic).
|
|
|
|
// OpenAI chat content blocks + tool_call wrapper.
|
|
export const OPENAI_BLOCK = {
|
|
TEXT: "text",
|
|
IMAGE_URL: "image_url",
|
|
IMAGE: "image",
|
|
INPUT_AUDIO: "input_audio",
|
|
AUDIO_URL: "audio_url",
|
|
FUNCTION: "function",
|
|
};
|
|
|
|
// Claude content blocks.
|
|
export const CLAUDE_BLOCK = {
|
|
TEXT: "text",
|
|
IMAGE: "image",
|
|
TOOL_USE: "tool_use",
|
|
TOOL_RESULT: "tool_result",
|
|
THINKING: "thinking",
|
|
REDACTED_THINKING: "redacted_thinking",
|
|
};
|
|
|
|
// OpenAI Responses API item types.
|
|
export const RESPONSES_ITEM = {
|
|
MESSAGE: "message",
|
|
FUNCTION_CALL: "function_call",
|
|
FUNCTION_CALL_OUTPUT: "function_call_output",
|
|
REASONING: "reasoning",
|
|
OUTPUT_TEXT: "output_text",
|
|
INPUT_TEXT: "input_text",
|
|
INPUT_IMAGE: "input_image",
|
|
SUMMARY_TEXT: "summary_text",
|
|
};
|
|
|
|
// Valid OpenAI block types (used by filterToOpenAIFormat).
|
|
export const VALID_OPENAI_CONTENT_TYPES = [
|
|
OPENAI_BLOCK.TEXT, OPENAI_BLOCK.IMAGE_URL, OPENAI_BLOCK.IMAGE, OPENAI_BLOCK.INPUT_AUDIO, OPENAI_BLOCK.AUDIO_URL,
|
|
];
|
|
export const VALID_OPENAI_MESSAGE_TYPES = [
|
|
OPENAI_BLOCK.TEXT, OPENAI_BLOCK.IMAGE_URL, OPENAI_BLOCK.IMAGE, "tool_calls", CLAUDE_BLOCK.TOOL_RESULT,
|
|
];
|