MCPcopy Create free account

hub / github.com/su-kaka/gcli2api / functions

Functions693 in github.com/su-kaka/gcli2api

↓ 2 callersFunctionwrap_cli_request
将 Gemini 格式请求包装成 Antigravity CLI 格式。 返回 (payload, request_id)。
src/api/antigravity.py:196
↓ 1 callersFunction_anchor_headers
()
src/api/vertex.py:82
↓ 1 callersFunction_anthropic_usage_from_metadata
(usage_metadata: Any)
src/converter/anthropic2gemini.py:205
↓ 1 callersMethod_auto_cleanup
自动清理死连接
src/panel/utils.py:71
↓ 1 callersFunction_build_labels
(model: str, trajectory_id: str, step: int)
src/api/antigravity.py:185
↓ 1 callersFunction_build_non_stream_response
从 batchGraphql 响应中提取并组装标准 Gemini generateContent 响应体。 返回 Gemini 格式 dict,None(解析失败),或 {"auth_error": msg}。
src/api/vertex.py:915
↓ 1 callersFunction_build_variables
从 gemini_payload 提取 variables(不含 region/recaptchaToken)。
src/api/vertex.py:373
↓ 1 callersFunction_cached_content_token_count
(usage_metadata: Any)
src/converter/anthropic2gemini.py:199
↓ 1 callersMethod_check_done_marker_in_chunk_content
检查单个chunk内容中是否包含done标记
src/converter/anti_truncation.py:551
↓ 1 callersFunction_clean_parameters_json_schema
Clean a tool schema for Code Assist's parametersJsonSchema field.
src/converter/gemini_fix.py:55
↓ 1 callersFunction_clean_part
清洗单个 part,去除空垃圾字段,返回 None 表示整个 part 无效。
src/api/vertex.py:513
↓ 1 callersFunction_clean_schema_for_gemini
清理 JSON Schema,转换为 Gemini 支持的格式 参考 worker.mjs 的 transformOpenApiSchemaToGemini 实现 处理逻辑: 1. 解析 $ref 引用 2. 合并 allOf 中的 schema
src/converter/openai2gemini.py:347
↓ 1 callersFunction_clear_log_file
清空日志文件(启动时调用,此时 writer 线程尚未启动,直接操作安全)
log.py:92
↓ 1 callersMethod_create_indexes
创建索引
src/storage/mongodb_manager.py:92
↓ 1 callersMethod_create_tables
创建数据库表和索引
src/storage/sqlite_manager.py:156
↓ 1 callersMethod_create_tables
创建数据库表和索引
src/storage/psql_manager.py:74
↓ 1 callersFunction_drop_invalid_tool_turns
删除 name 为空的 functionCall 所在的整轮工具调用(model + user functionResponse 一起删)。 Gemini 不接受 name 为空的 functionCall,这类 part 是上游客户端产生的无效历史记录。
src/api/vertex.py:260
↓ 1 callersFunction_ensure_empty_tool_schema_for_claude
(tools: Any, model_name: str)
src/converter/gemini_fix.py:289
↓ 1 callersMethod_ensure_schema_compatibility
确保数据库结构兼容,自动修复缺失的列
src/storage/sqlite_manager.py:118
↓ 1 callersMethod_ensure_schema_compatibility
确保数据库结构兼容,自动修复缺失的列
src/storage/psql_manager.py:148
↓ 1 callersMethod_extract_content_from_chunk
从chunk数据中提取文本内容
src/converter/anti_truncation.py:432
↓ 1 callersMethod_extract_content_from_response
从响应数据中提取文本内容
src/converter/anti_truncation.py:555
↓ 1 callersFunction_extract_tool_result_output
从 tool_result.content 中提取输出字符串
src/converter/anthropic2gemini.py:393
↓ 1 callersFunction_fetch_recaptcha_token_once
单次尝试获取 reCAPTCHA token,失败返回 None。
src/api/vertex.py:153
↓ 1 callersFunction_fix_function_response_names
补全 function_response 中缺失的 name 字段。 按顺序收集所有 function_call 的 name,再按顺序填给缺 name 的 function_response。
src/api/vertex.py:342
↓ 1 callersFunction_fix_thought_signatures
补全所有 functionCall/thought part 缺失的 thoughtSignature。 只要 part 含 functionCall、thought 或 thoughtSignature 字段,就确保 thoughtSignature 存在。 没有真实签名
src/api/vertex.py:300
↓ 1 callersFunction_generate_request_id
(conversation_id: str, trajectory_id: str, step: int)
src/api/antigravity.py:180
↓ 1 callersFunction_get_cached_config
从内存缓存获取配置(同步)
config.py:92
↓ 1 callersFunction_get_current_log_level
()
log.py:50
↓ 1 callersFunction_get_finish_reason
(chunk: Dict[str, Any])
src/api/vertex.py:584
↓ 1 callersFunction_get_log_file_path
()
log.py:54
↓ 1 callersMethod_get_next_available_from_redis
Redis 快速路径:随机取候选凭证,跳过冷却中的,返回 (filename, credential_data)。 失败或池为空时返回 None,由调用方降级到 MongoDB。
src/storage/mongodb_manager.py:390
↓ 1 callersFunction_get_onboard_tier
从 loadCodeAssist 响应中获取用户应该注册的 tier Returns: tier_id (如 "FREE", "STANDARD", "LEGACY") 或 None
src/google_oauth_api.py:805
↓ 1 callersFunction_get_redis
懒初始化 Redis 客户端,REDIS_URL 未设置时返回 None。
src/api/antigravity.py:69
↓ 1 callersFunction_get_session_state
(request_payload: Dict[str, Any], model: str = "")
src/api/antigravity.py:146
↓ 1 callersMethod_handle_non_streaming_response
处理非流式响应 - 使用循环代替递归避免栈溢出
src/converter/anti_truncation.py:459
↓ 1 callersMethod_init_redis
初始化 Redis 连接并重建凭证池缓存(若 REDIS_URL 存在)
src/storage/mongodb_manager.py:170
↓ 1 callersMethod_is_permanent_refresh_failure
判断是否是凭证永久失效的错误 Args: error_msg: 错误信息 status_code: HTTP状态码(如果有) Returns: True表示凭证永久失效应封禁
src/credential_manager.py:433
↓ 1 callersFunction_map_raw_tier
将 loadCodeAssist 返回的 raw tier 映射为统一 tier。
src/google_oauth_api.py:561
↓ 1 callersFunction_normalize_function_name
规范化函数名以符合 Gemini API 要求 规则: - 必须以字母或下划线开头 - 只能包含 a-z, A-Z, 0-9, 下划线, 英文句点, 英文短划线 - 最大长度 64 个字符 转换策略: 1. 中文字符转换为拼音 2
src/converter/openai2gemini.py:100
↓ 1 callersFunction_normalize_part_thought_signature
(part: Dict[str, Any], model_name: str)
src/converter/gemini_fix.py:348
↓ 1 callersFunction_normalize_tools_for_internal_api
(tools: Any)
src/converter/gemini_fix.py:243
↓ 1 callersFunction_now_ts
()
log.py:177
↓ 1 callersFunction_parse_size_to_image_config
解析用户传入的 size 参数为 Gemini imageConfig 参数 支持格式: "1024x1536", "1024*1536", "1024X1536" Returns: 包含 aspectRatio 和/或 imageSize 的字典
src/converter/gemini_fix.py:362
↓ 1 callersFunction_process_object
处理单个上游 JSON 对象,提取 Gemini chunk。 返回 (chunk, auth_error_msg, is_quota_error)。
src/api/vertex.py:463
↓ 1 callersFunction_prune_session_states
(now: float)
src/api/antigravity.py:117
↓ 1 callersFunction_random_string
(n: int)
src/api/vertex.py:76
↓ 1 callersMethod_redis_add_cred
将凭证加入 Redis 可用池及对应 tier 分桶、preview 分桶
src/storage/mongodb_manager.py:336
↓ 1 callersFunction_refresh_config
从环境变量刷新缓存配置(模块加载时及需要时调用)
log.py:41
↓ 1 callersMethod_refresh_token
刷新token并更新存储
src/credential_manager.py:358
↓ 1 callersMethod_remove_done_marker_from_line
从行中移除[done]标记
src/converter/anti_truncation.py:580
↓ 1 callersMethod_repair_credential_filenames
修复凭证数据库中可能包含路径的文件名,确保所有文件名都是 basename
src/storage/sqlite_manager.py:255
↓ 1 callersFunction_resolve_schema_ref
(ref: str, root_schema: Dict[str, Any])
src/converter/gemini_fix.py:41
↓ 1 callersFunction_reverse_transform_args
递归转换函数参数,将字符串转回原始类型 参考 worker.mjs 的 reverseTransformArgs Args: args: 函数参数(可能是字典、列表或其他类型) Returns:
src/converter/openai2gemini.py:1021
↓ 1 callersFunction_reverse_transform_value
将值转换回原始类型(Gemini 可能将所有值转为字符串) 仅处理 Gemini 在工具参数中常见的布尔/空值字符串化情况, 不再对数字字符串做启发式转换,避免把 schema 声明为 string 的参数错误还原成 integer。 参考 wo
src/converter/openai2gemini.py:988
↓ 1 callersFunction_run
()
web.py:176
↓ 1 callersMethod_run
保活循环,读取到有效URL才会被调用
src/keeplive.py:21
↓ 1 callersFunction_sanitize_openai_roundtrip_signatures
OpenAI-compatible clients may round-trip Gemini thinking signatures through fields we do not fully control. Keep tool calls on the safe bypas
src/converter/openai2gemini.py:1141
↓ 1 callersFunction_session_key
(request_payload: Dict[str, Any], model: str = "")
src/api/antigravity.py:105
↓ 1 callersMethod_should_refresh_token
检查token是否需要刷新
src/credential_manager.py:303
↓ 1 callersFunction_should_skip_thought_signature
(part: Dict[str, Any], model_name: str)
src/converter/gemini_fix.py:335
↓ 1 callersFunction_start_writer_thread
()
log.py:182
↓ 1 callersFunction_stop_writer_thread
()
log.py:191
↓ 1 callersFunction_try_load_code_assist
尝试通过 loadCodeAssist 获取 project_id 和订阅等级 Returns: (project_id, subscription_tier, credit_amount) 元组 subscription_tier 可能是 "FR
src/google_oauth_api.py:634
↓ 1 callersFunction_try_onboard_user
尝试通过 onboardUser 获取 project_id(长时间运行操作,需要轮询) Returns: project_id 或 None
src/google_oauth_api.py:716
↓ 1 callersFunction_write_to_file
(message: str)
log.py:209
↓ 1 callersMethodadd_antigravity_credential
新增或更新一个Antigravity凭证 存储层会自动处理轮换顺序
src/credential_manager.py:113
↓ 1 callersMethodadd_credential
新增或更新一个凭证 存储层会自动处理轮换顺序
src/credential_manager.py:104
↓ 1 callersFunctionanti_truncation_generator
()
src/router/antigravity/gemini.py:219
↓ 1 callersFunctionanti_truncation_generator
()
src/router/antigravity/openai.py:223
↓ 1 callersFunctionanti_truncation_generator
()
src/router/antigravity/anthropic.py:222
↓ 1 callersFunctionanti_truncation_generator
()
src/router/geminicli/gemini.py:216
↓ 1 callersFunctionanti_truncation_generator
()
src/router/geminicli/openai.py:223
↓ 1 callersFunctionanti_truncation_generator
()
src/router/geminicli/anthropic.py:222
↓ 1 callersFunctionapply_cred_result
(cred_result: Tuple[str, Dict[str, Any]])
src/api/geminicli.py:206
↓ 1 callersFunctionapply_cred_result
(cred_result: Tuple[str, Dict[str, Any]])
src/api/antigravity.py:375
↓ 1 callersFunctionapply_regex_replacements
对文本应用正则替换规则 Args: text: 要处理的文本 Returns: 处理后的文本
src/converter/anti_truncation.py:39
↓ 1 callersFunctionapply_regex_replacements_to_payload
对请求payload中的文本内容应用正则替换 Args: payload: 请求payload Returns: 应用替换后的payload
src/converter/anti_truncation.py:78
↓ 1 callersFunctionasyncio_complete_auth_flow
异步完成认证流程,支持自动检测项目ID
src/auth.py:515
↓ 1 callersFunctionautoLogin
()
front/common.js:866
↓ 1 callersMethodbroadcast
(self, message: str)
src/panel/utils.py:58
↓ 1 callersFunctionbuild_generation_config
根据 Anthropic Messages 请求构造下游 generationConfig。 Returns: generation_config: 生成配置字典
src/converter/anthropic2gemini.py:626
↓ 1 callersFunctionbytes_wrapper
()
src/router/antigravity/anthropic.py:265
↓ 1 callersFunctionbytes_wrapper
()
src/router/geminicli/anthropic.py:265
↓ 1 callersFunctioncheck_should_auto_ban
检查是否应该触发自动封禁 Args: status_code: HTTP状态码 Returns: bool: 是否应该触发自动封禁
src/api/utils.py:26
↓ 1 callersFunctionclean_json_schema
清理 JSON Schema,移除下游不支持的字段,并把验证要求追加到 description。
src/converter/anthropic2gemini.py:267
↓ 1 callersMethodcleanup_dead_connections
清理已断开的连接
src/panel/utils.py:78
↓ 1 callersMethodclear_all_model_cooldowns
清除某个凭证的所有模型冷却时间
src/storage/psql_manager.py:955
↓ 1 callersFunctioncollect_streaming_response
将Gemini流式响应收集为一条完整的非流式响应 Args: stream_generator: 流式响应生成器,产生 "data: {json}" 格式的行或Response对象 Returns: Response: 合并后的完整响应对
src/api/utils.py:232
↓ 1 callersFunctioncomplete_auth_flow_from_callback_url
从回调URL直接完成认证流程,无需启动本地服务器
src/auth.py:770
↓ 1 callersFunctionconnectWebSocket
()
front/common.js:2457
↓ 1 callersFunctionconvert_messages_to_contents
将 Anthropic messages[] 转换为下游 contents[](role: user/model, parts: [])。 Args: messages: Anthropic 格式的消息列表 include_thinking: 是否
src/converter/anthropic2gemini.py:407
↓ 1 callersFunctionconvert_openai_tools_to_gemini
将 OpenAI tools 格式转换为 Gemini functionDeclarations 格式 Args: openai_tools: OpenAI 格式的工具列表(可能是字典或 Pydantic 模型) model: 模型名称(用于判断是
src/converter/openai2gemini.py:831
↓ 1 callersFunctionconvert_tool_choice_to_tool_config
将 OpenAI tool_choice 转换为 Gemini toolConfig Args: tool_choice: OpenAI 格式的 tool_choice Returns: Gemini 格式的 toolConfig
src/converter/openai2gemini.py:902
↓ 1 callersFunctionconvert_tool_choice_to_tool_config
将 Anthropic tool_choice 转换为 Gemini toolConfig Args: tool_choice: Anthropic 格式的 tool_choice - {"type": "auto"}: 模型自动决定是否使
src/converter/anthropic2gemini.py:585
↓ 1 callersFunctionconvert_tools
将 Anthropic tools[] 转换为下游 tools(functionDeclarations)结构。
src/converter/anthropic2gemini.py:360
↓ 1 callersFunctioncount_str
(obj: Any)
src/token_estimator.py:13
↓ 1 callersFunctioncreateCredCard
(credInfo, manager)
front/common.js:633
↓ 1 callersFunctioncreate_auth_url
创建认证URL,支持动态端口分配
src/auth.py:233
↓ 1 callersFunctioncreate_callback_server
创建指定端口的回调服务器,优化快速关闭
src/auth.py:180
← previousnext →201–300 of 693, ranked by callers