1123Javayanglei/vscode-chat-proxy/proxy does not have a README file

    ProxyError

    pub(all) suberror ProxyError {
    ProxyError(String)
    }

    ensure_system_prefix

    fn ensure_system_prefix(root :
    Json
    ) -> Bool

    Ensure the first system message of a Chat Completions request body starts with the built-in required_prefix.

    Prefer ensure_system_prefix_with with the configured prompt; this wrapper keeps the historical API (and the historical default sentence) stable.

    ensure_system_prefix_with

    fn ensure_system_prefix_with(root :
    Json
    , prompt : String) -> Bool

    Ensure the first system message of a Chat Completions request body starts with prompt (typically @config.Config::system_prompt).

    • first system message already starts with it: unchanged;
    • otherwise the sentence is prepended to its content (plain string content, or the first text part of multimodal content);
    • no system message at all: one is inserted at the front of messages.
    • a blank prompt falls back to required_prefix.

    Returns true when the JSON was modified.

    handle_connection

    Handle one client connection: read one HTTP request, optionally rewrite the Chat Completions system message, forward it to the upstream and stream the response back (SSE works). The connection is closed afterwards (Connection: close). Every proxied request is recorded in the flow store for the monitor UI.

    required_prefix

    let required_prefix : String

    The built-in required opening sentence of the system message.

    This is only the default: the actual sentence comes from the config (SYSTEM_PROMPT in .env / the environment, or --system-prompt), see @config.Config::system_prompt.