Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Script Profile for ChatGPT | Scripts Sharing #520

Closed
@zzzgydi

Description

@zzzgydi

分享一段针对ChatGPT的分组规则,可以根据自己的需求更改regexrulesregex是匹配出能访问ChatGPT节点的正则,rules是clash rules,分组名为ChatGPT

// New Proxy Group for ChatGPT

function main(params) {
  // TODO modify this regex to what you want
  const regex = /||/;
  
  // TODO modify this rules to what you want
  const rules = [
    "DOMAIN-KEYWORD,openai,ChatGPT",
    "DOMAIN-KEYWORD,cloudfare,ChatGPT"
  ];

  const proxies = params.proxies
    .filter((e) => regex.test(e.name))
    .map((e) => e.name);

  const groups = params["proxy-groups"];

  const newGroup = {
    name: "ChatGPT",
    type: "select",
    proxies,
  };

  if (groups.length > 1) {
    groups.splice(1, 0, newGroup);
    params.rules = rules.concat(params.rules);
  }

  return params;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions