Files
pdd_AI/native/src/WebConsole.h
T
zhangyu 2b55aa5a44 Add native client with image adjustment and AI hybrid intent mode
Switch to WebView2 host with embedded resources, save chat images by order, and support buyer photo replace/delete via rules, dHash matching, and optional model-assisted intent parsing.
2026-11-11 02:19:26 +08:00

46 lines
1.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <windows.h>
#include <wrl.h>
#include <string>
#include <vector>
#include "Json.h"
#include "WebView2.h"
namespace pddai {
// 内嵌客服台:每个店铺一份独立的 WebView2 Environment(独立 user data folder → 独立 cookie),
// Controller 的父窗口是主窗口,Bounds 由前端上报的内容区矩形决定。
// 之所以不用 iframe:iframe 拿不到 MAIN world 的原生 API 覆写时机,
// 也伪造不了 outerWidth/outerHeight 这组窗口级几何特征。
class WebConsole {
public:
// 打开并切换到该店铺的内嵌台;首次调用时异步创建 Environment 与 Controller。
// shopId 为空时取 shops.json 里的第一个店铺。
static bool Open(HWND owner, const std::string& shopId);
// 销毁某个店铺的 Controller 并释放它的配置目录占用
static void Close(const std::string& shopId);
static void CloseAll();
static bool IsOpen(); // 任一店铺已打开
static bool IsOpen(const std::string& shopId);
// 退出该店铺的拼多多登录:清除该配置目录下的 cookie 与站点数据后重新加载
static bool Logout(const std::string& shopId);
static std::vector<std::string> OpenShopIds();
// 前端上报内容区矩形(客户区 CSS 像素)。visible=false 时隐藏当前店铺。
static void SetLayout(const RECT& rect, bool visible);
// HTTP 线程调用:按 payload 里的 shopId 找到对应店铺,封送到 UI 线程执行真实输入
static bool DispatchInput(const json& payload, std::string& error);
// 由主窗口 WndProc 在 WM_APP_CONSOLE_INPUT 时调用(UI 线程)
static void HandleUiInputMessage(LPARAM lParam);
};
} // namespace pddai