mirror of
https://github.com/primedigitaltech/market-assistant.git
synced 2026-07-21 23:41:39 +08:00
新增 pipeline/openai_gateway:credentials、text_chat、ingredients_op、ingredients_defaults 等;AI_crawler 仅加载 .env 与重导出。CrawlerOpenAiCompatible 与京东详情/流水线改走 import pipeline.openai_gateway,不再依赖 sys.path 注入爬虫目录。llm/providers/shared 转重导 gateway。详情脚本补充 backend 入 path。 Made-with: Cursor
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
"""
|
|
OpenAI 兼容网关(`chat/completions`):纯文本、多模态配料、详情长图逆序等。
|
|
|
|
与 ``crawler_copy/.../AI_crawler`` 解耦,逻辑唯一来源在 ``pipeline.openai_gateway``。
|
|
脚本 ``AI_crawler.py`` 仅作加载 .env 与命令行试跑、并向后兼容重导出名。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from .chat_content import normalize_message_content
|
|
from .credentials import (
|
|
_resolve_credentials,
|
|
resolve_credentials,
|
|
resolve_text_model_name,
|
|
)
|
|
from .ingredients_op import (
|
|
REASON_NO_BODY_URLS,
|
|
REASON_NO_VISION_API,
|
|
extract_ingredients_from_body_image_urls_reversed,
|
|
extract_ingredients_from_body_image_urls_reversed_with_source,
|
|
extract_ingredients_from_image,
|
|
normalize_ingredients_text_for_csv,
|
|
parse_joined_image_urls,
|
|
sanitize_vision_ingredients_output,
|
|
)
|
|
from .text_chat import chat_completion_text, strip_outer_markdown_fence
|
|
|
|
__all__ = [
|
|
"REASON_NO_BODY_URLS",
|
|
"REASON_NO_VISION_API",
|
|
"_resolve_credentials",
|
|
"chat_completion_text",
|
|
"extract_ingredients_from_body_image_urls_reversed",
|
|
"extract_ingredients_from_body_image_urls_reversed_with_source",
|
|
"extract_ingredients_from_image",
|
|
"normalize_ingredients_text_for_csv",
|
|
"normalize_message_content",
|
|
"parse_joined_image_urls",
|
|
"resolve_credentials",
|
|
"resolve_text_model_name",
|
|
"sanitize_vision_ingredients_output",
|
|
"strip_outer_markdown_fence",
|
|
]
|