MCPcopy Create free account

hub / github.com/HisMax/RedInk / functions

Functions355 in github.com/HisMax/RedInk

↓ 288 callersMethodget
(self, url, timeout=None)
tests/image_api_client_test.py:31
↓ 42 callersFunctionapi_error_response
返回统一结构化 API 错误响应。
backend/routes/utils.py:57
↓ 16 callersFunctionsetError
(error: unknown, fallbackTitle = '操作失败')
frontend/src/composables/useProviderForm.ts:194
↓ 15 callersMethodget_record
获取历史记录详情 Args: record_id: 记录 ID Returns: Optional[Dict]: 记录详情,如果不存在则返回 None 返回数据包含:
backend/services/history.py:156
↓ 13 callersMethodpost
(self, url, headers=None, json=None, timeout=None)
tests/image_api_client_test.py:27
↓ 12 callersFunctionget_history_service
获取历史记录服务实例(单例模式) Returns: HistoryService: 历史记录服务实例
backend/services/history.py:715
↓ 12 callersFunctionvalidation_error
构造参数校验错误。
backend/routes/utils.py:66
↓ 10 callersFunctionclassify_error
(error: Union[Exception, str], context: Optional[Dict[str, Any]] = None)
backend/errors.py:72
↓ 10 callersFunctioncompress_image
压缩图片到指定大小以内 Args: image_data: 原始图片数据 max_size_kb: 最大文件大小(KB) quality_start: 起始压缩质量(1-100) quality_min: 最低压缩质
backend/utils/image_compressor.py:7
↓ 8 callersFunctionlegacyMessageToError
( message: string, fallbackTitle = '操作失败', status = 500, suggestion?: string )
frontend/src/utils/errors.ts:80
↓ 7 callersMethod_load_index
加载索引文件 Returns: Dict: 索引数据,包含 records 列表
backend/services/history.py:59
↓ 7 callersMethodfrom_config
( cls, config: Dict[str, Any], default_model: str = "default-model", default_e
backend/generators/image_provider_policy.py:20
↓ 7 callersFunctiongetApiErrorPayload
(error: unknown, fallback: string)
frontend/src/api/client.ts:6
↓ 7 callersFunctionlog_error
记录 API 错误日志 Args: endpoint: API 端点路径 error: 异常对象
backend/routes/utils.py:43
↓ 7 callersFunctionnormalize_error_result
将 service 返回的旧格式错误转换为统一错误对象,同时保留兼容字段。
backend/routes/utils.py:78
↓ 7 callersMethodupdate_record
更新历史记录 支持部分更新,只更新提供的字段。 每次更新都会自动刷新 updated_at 时间戳。 Args: record_id: 记录 ID outline: 大纲内容(可选,
backend/services/history.py:207
↓ 6 callersFunctionautoSaveConfig
* 自动保存配置
frontend/src/composables/useProviderForm.ts:168
↓ 6 callersMethodcreate_record
创建新的历史记录 初始状态为 draft(草稿),表示大纲已创建但尚未开始生成图片。 Args: topic: 绘本主题/标题 outline: 大纲内容,包含 pages 数组等信息
backend/services/history.py:94
↓ 6 callersFunctionlog_request
记录 API 请求日志 Args: endpoint: API 端点路径 data: 请求数据(会过滤敏感信息)
backend/routes/utils.py:17
↓ 5 callersMethod_count_generated
(generated_images: List[str])
backend/services/image.py:82
↓ 5 callersMethod_generate_single_image
生成单张图片(带自动重试) Args: page: 页面数据 task_id: 任务ID reference_image: 参考图片(封面图) retry_count:
backend/services/image.py:138
↓ 5 callersMethod_get_record_path
获取历史记录文件路径 Args: record_id: 记录 ID Returns: str: 记录文件的完整路径
backend/services/history.py:82
↓ 5 callersFunction_truncate
(value: str, limit: int)
backend/errors.py:387
↓ 5 callersFunctionget_image_service
获取全局图片生成服务实例
backend/services/image.py:911
↓ 5 callersFunctioninferCode
(message: string)
frontend/src/utils/errors.ts:103
↓ 5 callersFunctionmake_history_service
(tmp_path: Path)
tests/history_and_image_service_test.py:8
↓ 5 callersFunctionnormalizeApiError
(error: ErrorLike, fallbackTitle = '操作失败')
frontend/src/utils/errors.ts:16
↓ 5 callersFunctionsetSuccess
(message: string)
frontend/src/composables/useProviderForm.ts:190
↓ 4 callersFunctionensure_app_error
(error: Union[AppError, Exception, str], context: Optional[Dict[str, Any]] = None)
backend/errors.py:54
↓ 4 callersMethodextract_from_images_response
(self, result: Dict[str, Any])
backend/generators/image_response_extractor.py:16
↓ 4 callersFunctionformatErrorMessage
(error: ErrorLike, fallbackTitle = '操作失败')
frontend/src/utils/errors.ts:54
↓ 4 callersMethodgenerate_via_images
(self, payload: Dict[str, Any])
backend/generators/image_api_client.py:29
↓ 4 callersMethodhas_images
(generated: Optional[List[str]])
backend/services/history_image_merger.py:10
↓ 4 callersMethodjson
(self)
tests/errors_test.py:148
↓ 4 callersFunctiontestConnection
(config: { type: string provider_name?: string api_key?: string base_url?: string endpoint_type?: st
frontend/src/api/config.ts:26
↓ 3 callersMethod_decode_base64_image
(value: str)
backend/generators/image_response_extractor.py:82
↓ 3 callersFunction_first_meaningful_line
(value: str)
backend/errors.py:366
↓ 3 callersFunction_llm_smoke_response_payload
(result: LlmSmokeResult)
backend/routes/config_routes.py:586
↓ 3 callersFunction_normalize_sse_error
(event_type: str, data: dict, context: dict)
backend/routes/image_routes.py:451
↓ 3 callersFunction_read_config
读取配置文件
backend/routes/config_routes.py:198
↓ 3 callersMethod_remember_generated
(generated_images: List[str], index: int, filename: str, total: int)
backend/services/image.py:86
↓ 3 callersMethod_save_index
保存索引文件 Args: index: 索引数据
backend/services/history.py:72
↓ 3 callersMethodcompute_status
(generated: Optional[List[str]], total_count: int)
backend/services/history_image_merger.py:44
↓ 3 callersMethoddownload_image
(self, url: str)
backend/generators/image_api_client.py:37
↓ 3 callersFunctionencoded_payload
(data=b"image-bytes")
tests/image_api_client_test.py:36
↓ 3 callersMethodfirst_image
(generated: Optional[List[str]])
backend/services/history_image_merger.py:53
↓ 3 callersMethodgenerate_image
生成图片 Args: prompt: 提示词 model: 模型名称 aspect_ratio: 宽高比 temperature: 温度 Return
backend/utils/genai_client.py:177
↓ 3 callersFunctionisAppError
(value: any)
frontend/src/utils/errors.ts:72
↓ 3 callersFunctionparse_genai_error
解析 Google GenAI API 错误,返回用户友好的错误信息 识别的错误类型: - 401 UNAUTHENTICATED: API Key 无效或认证失败 - 403 PERMISSION_DENIED: 权限不足 - 404 NOT_FOUND
backend/generators/google_genai.py:13
↓ 3 callersMethodto_dict
(self)
backend/errors.py:27
↓ 3 callersMethodto_message
(self)
backend/errors.py:39
↓ 2 callersFunction_check_response
检查响应是否符合预期
backend/routes/config_routes.py:597
↓ 2 callersFunction_error_context
(provider_type: str = None, provider_name: str = None, config: dict = None)
backend/routes/config_routes.py:331
↓ 2 callersMethod_init_index
初始化索引文件 如果索引文件不存在,则创建一个空索引
backend/services/history.py:49
↓ 2 callersMethod_load_prompt_template
加载 Prompt 模板
backend/services/image.py:92
↓ 2 callersMethod_post_json
(self, payload: Dict[str, Any], label: str)
backend/generators/image_api_client.py:52
↓ 2 callersFunction_sanitize_diagnostics
(data: Dict[str, Any])
backend/errors.py:259
↓ 2 callersMethod_sleep_for_retry
(self, attempt: int, response: Optional[requests.Response] = None)
backend/generators/image_api_client.py:114
↓ 2 callersFunction_summarize_html
(value: str)
backend/errors.py:380
↓ 2 callersFunction_test_openai_chat_completion
用当前配置发送一次真实 OpenAI-compatible LLM 请求。
backend/routes/config_routes.py:443
↓ 2 callersFunction_update_provider_config
更新服务商配置 Args: config_path: 配置文件路径 new_data: 新的配置数据
backend/routes/config_routes.py:212
↓ 2 callersFunctioncreateEmptyImageForm
* 创建空的图片服务商表单
frontend/src/composables/useProviderForm.ts:127
↓ 2 callersFunctioncreateEmptyTextForm
* 创建空的文本服务商表单
frontend/src/composables/useProviderForm.ts:111
↓ 2 callersFunctioncreate_app
()
backend/app.py:38
↓ 2 callersFunctionerror_payload
(error: Union[AppError, Exception, str], context: Optional[Dict[str, Any]] = None)
backend/errors.py:45
↓ 2 callersMethodfiles_by_index
(history_dir: str, task_id: str)
backend/services/history_image_merger.py:60
↓ 2 callersFunctionfinishIfAllImagesDone
()
frontend/src/composables/useImageRetry.ts:18
↓ 2 callersFunctiongenerate
SSE 事件生成器
backend/routes/image_routes.py:85
↓ 2 callersMethodgenerate_content
生成标题、文案和标签 参数: topic: 用户输入的主题 outline: 大纲内容 返回: 包含 titles, copywriting, tags 的字典
backend/services/content.py:134
↓ 2 callersMethodgenerate_text
生成文本 Args: prompt: 提示词 model: 模型名称 temperature: 温度 max_output_tokens: 最大输出 token
backend/utils/genai_client.py:100
↓ 2 callersMethodgenerate_via_chat
(self, payload: Dict[str, Any])
backend/generators/image_api_client.py:33
↓ 2 callersMethodget_active_image_provider
(cls)
backend/config.py:86
↓ 2 callersMethodget_cached_generation_events
(self, record_id: str, pages: list)
backend/services/image.py:565
↓ 2 callersFunctionget_text_chat_client
获取 Text Chat 客户端实例(根据 type 返回对应客户端) Args: provider_config: 服务商配置字典 - type: 'google_gemini' 或 'openai_compatible'
backend/utils/text_client.py:254
↓ 2 callersMethodload_image_providers_config
(cls)
backend/config.py:19
↓ 2 callersMethodmerge_generated_image
按页面索引合并单张已生成图片。
backend/services/history.py:294
↓ 2 callersMethodmerge_many
( existing: Optional[List[str]], files_by_index: Dict[int, str], total_count: Optional
backend/services/history_image_merger.py:28
↓ 2 callersFunctionprepare_providers_for_response
准备返回给前端的 providers 数据 将 api_key 替换为脱敏版本,避免泄露 Args: providers: 原始服务商配置字典 Returns: dict: 处理后的服务商配置
backend/routes/utils.py:117
↓ 2 callersFunctionreadErrorResponse
(response: Response, fallback: string)
frontend/src/api/client.ts:37
↓ 2 callersFunctionreadSseResponse
( response: Response, handlers: Record<string, (data: any) => void> )
frontend/src/api/client.ts:45
↓ 2 callersMethodretry_failed_images
批量重试失败的图片 Args: task_id: 任务ID pages: 需要重试的页面列表 Yields: 进度事件
backend/services/image.py:709
↓ 2 callersMethodretry_single_image
重试生成单张图片 Args: task_id: 任务ID page: 页面数据 use_reference: 是否使用封面作为参考 full_outline: 完整大纲
backend/services/image.py:625
↓ 2 callersMethodscan_and_sync_task_images
扫描任务文件夹,同步图片列表 根据实际生成的图片数量自动更新记录状态: - 无图片 -> draft(草稿) - 部分图片 -> partial(部分完成) - 全部图片 -> completed(已完成)
backend/services/history.py:552
↓ 1 callersMethod_build_content_with_images
构建包含图片的 content Args: text: 文本内容 images: 图片列表,可以是 bytes(图片数据)或 str(URL) Returns: 如果没有图片
backend/utils/text_client.py:66
↓ 1 callersFunction_clear_config_cache
清除配置缓存
backend/routes/config_routes.py:250
↓ 1 callersFunction_create_images_zip
创建包含所有图片的 ZIP 文件 Args: task_dir: 任务目录路径 Returns: io.BytesIO: 内存中的 ZIP 文件
backend/routes/history_routes.py:456
↓ 1 callersMethod_encode_image_to_base64
将图片数据编码为 base64
backend/utils/text_client.py:62
↓ 1 callersFunction_extract_chat_completion_text
(result: dict)
backend/routes/config_routes.py:496
↓ 1 callersFunction_extract_endpoint
(raw: str)
backend/errors.py:317
↓ 1 callersFunction_extract_host
(raw: str)
backend/errors.py:307
↓ 1 callersFunction_extract_reasoning_token_count
(result: dict)
backend/routes/config_routes.py:534
↓ 1 callersFunction_extract_status_and_message
(raw: str)
backend/errors.py:273
↓ 1 callersFunction_format_llm_success_message
(result: LlmSmokeResult)
backend/routes/config_routes.py:579
↓ 1 callersMethod_generate_via_chat_api
通过 chat/completions 端点生成图片 支持多种返回格式: 1. Markdown 图片链接: ![xxx](url) - 即梦、部分中转站使用 2. Base64 data URL: data:image/xxx;b
backend/generators/openai_compatible.py:97
↓ 1 callersMethod_generate_via_chat_api
通过 /v1/chat/completions 端点生成图片(如即梦 API)
backend/generators/image_api.py:146
↓ 1 callersMethod_generate_via_images_api
通过 images API 端点生成
backend/generators/openai_compatible.py:80
↓ 1 callersMethod_generate_via_images_api
通过 /v1/images/generations 端点生成图片
backend/generators/image_api.py:91
↓ 1 callersMethod_get_client
根据配置获取客户端
backend/services/content.py:61
↓ 1 callersMethod_get_client
根据配置获取客户端
backend/services/outline.py:54
↓ 1 callersMethod_headers
(self)
backend/generators/image_api_client.py:108
next →1–100 of 355, ranked by callers