""" @author: luojunhui """ import requests import json class AIDTApi(object): """ 自动操作 """ headers = { 'Accept': 'application/json', 'Accept-Language': 'zh,zh-CN;q=0.9', 'Content-Type': 'application/json', 'Origin': 'http://admin.cybertogether.net', 'Proxy-Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36' } person_info = { "token": "af54cdc404c3464d896745df389b2dce", "appType": 9, "platform": "pc", "appVersionCode": 1000, "clientTimestamp": 1, "fid": 1, "loginUid": 1, "pageSource": 1, "requestId": 1, "rid": 1, "uid": 1 } @classmethod def getPlanArticleList(cls, page_index, plan_id): """ 获取抓取计划下的文章list :param plan_id: :param page_index: :return: """ url = "http://aigc-api.cybertogether.net/aigc/crawler/content/list" payload = json.dumps({ "params": { "filterItems": [ { "itemName": "sourceCrawlerPlans", "selectValues": [plan_id] } ], "listFieldFormula": [], "pageNum": page_index, "pageSize": 50, "contentModal": 3 }, "baseInfo": cls.person_info }) response = requests.request("POST", url, headers=cls.headers, data=payload) return response.json() @classmethod def updateArticleIntoCrawlerPlan(cls, plan_id, plan_name, plan_tag, url_list): """ 往抓取计划加文章 :return: """ url = "http://aigc-api.cybertogether.net/aigc/crawler/plan/save" payload = json.dumps({ "params": { "contentFilters": [], "accountFilters": [], "filterAccountMatchMode": 1, "filterContentMatchMode": 1, "selectModeValues": [], "searchModeValues": [], "contentModal": 3, "analyze": {}, "crawlerComment": 0, "inputGroup": None, "inputSourceGroups": [], "modePublishTime": [], "planType": 2, "frequencyType": 2, "planTag": plan_tag, "tagPenetrateFlag": 0, "id": plan_id, "name": plan_name, "channel": 5, "crawlerMode": 5, "inputModeValues": url_list, "modePublishTimeStart": None, "modePublishTimeEnd": None, "executeRate": None, "executeDate": None, "executeWindowStart": None, "executeWindowEnd": None, "executeTimeInterval": None, "executeNum": None, "addModal": None, "addChannel": None, "fileUpload": None, "prompt": None, "acelFlag": None, "tasks": [] }, "baseInfo": cls.person_info }) response = requests.request("POST", url, headers=cls.headers, data=payload) print(json.dumps(response.json(), ensure_ascii=False, indent=4)) @classmethod def bindCrawlerPlanToGeneratePlan(cls): """ 绑定抓取计划到生成计划 :return: """ url = "http://aigc-api.cybertogether.net/aigc/produce/plan/save" payload = json.dumps({ "params": { "name": "flowPool4Test", "produceModal": 3, "planTag": "autoArticlePoolLevel4", "tagPenetrateFlag": 0, "moduleGroups": [ { "modules": [ { "produceModuleType": 1, "conditionOutputConfigs": [ { "outputConfigs": [ "task-ad66503e0cfb1dd18df9b8697156ed01-every-topAll" ] } ] }, { "produceModuleType": 2, "conditionOutputConfigs": [ { "outputConfigs": [ "task-bad7562d16c070ba488b9a64bdf8af67-every-topAll" ] } ] }, { "produceModuleType": 3, "conditionOutputConfigs": [ { "outputConfigs": [ "content|0|inputAll-标题-every-topAll" ] } ] }, { "produceModuleType": 4, "conditionOutputConfigs": [ { "outputConfigs": [ "task-28403a18b08241c2a07ed4122f045163-all-topAll" ] } ] }, { "produceModuleType": 10, "conditionOutputConfigs": [ { "outputConfigs": [ "content|0|inputAll-miniProgram-all" ] } ] } ] } ], "activeManualReview": 1, "dailyProduceNum": 200, "totalProduceNum": 10000, "inputSourceGroups": [ { "groupId": "0", "contentFilters": [], "contentOrders": [ { "orderField": 4, "orderType": "desc" }, { "orderField": 2, "orderType": "desc" } ], "filterMatchMode": 2, "inputType": None, "perInputCount": 1, "inputMaxUseCount": 1, "samplingType": 2, "groupName": "分组0", "inputSources": [ { "contentType": 1, "inputSourceModal": 3, "inputSourceChannel": 5, "inputSourceType": 2, "inputSourceValue": "20240724082230892806488", "inputSourceSubType": None, "fieldName": None, "inputSourceLabel": "原始帖子-长文-微信公众号-内容添加计划-冷启池子--军事政法" } ], "batchActive": 1 } ], "tasks": [ { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "85028b8433d186b95ecfcf8cfe12e20e", "modelName": "GPT-4", "auditProcessIndex": None, "name": "理解 事实信息和观点", "inputConfigs": [ "content|0|input1-正文-all-topAll" ], "inputFilterMatchMode": None, "inputReviewOpen": 0, "model": "GPT-4", "modelParam": None, "prompt": "【 {content|0|input1-正文-all-topAll} 】\n请总结其中所有事实型信息,并分拆其中所有观点", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "713bc86019b724007f2d81da182ba29d", "modelName": "GPT-4", "auditProcessIndex": None, "name": "理解 文章核心事件", "inputConfigs": [ "content|0|input1-正文-all-topAll", "content|0|input1-标题-all-topAll" ], "inputFilterMatchMode": None, "inputReviewOpen": 0, "model": "GPT-4", "modelParam": None, "prompt": "结合标题和正文,请你找出文章中围绕标题的事件信息,描述清楚发生了什么。\n1、标题:【 {content|0|input1-标题-all-topAll} 】\n2、正文:【 {content|0|input1-正文-all-topAll} 】", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "28bd9d91314c1f913f27bce1360070a6", "modelName": "GPT-4", "auditProcessIndex": None, "name": "联想 人们还想知道的", "inputConfigs": [ "task-713bc86019b724007f2d81da182ba29d-all-topAll" ], "inputFilterMatchMode": None, "inputReviewOpen": 0, "model": "GPT-4", "modelParam": None, "prompt": "【 {task-713bc86019b724007f2d81da182ba29d-all-topAll} 】这是一篇文章的中心思想,围绕它的事实主旨的部分,读者可能还想了解哪些信息?", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "e7ad826428c4d432f048c935de74c118", "modelName": "GPT-4", "auditProcessIndex": None, "name": "处理 对联想信息筛选", "inputConfigs": [ "task-28bd9d91314c1f913f27bce1360070a6-all-topAll", "content|0|input1-正文-all-topAll" ], "inputFilterMatchMode": None, "inputReviewOpen": 0, "model": "GPT-4", "modelParam": None, "prompt": "1、原文:【 {content|0|input1-正文-all-topAll} 】\n2、问题:【 {task-28bd9d91314c1f913f27bce1360070a6-all-topAll} 】\n请你基于原文内容,从问题中选择两到三点,这两点是你认为跟原文事件最为相关且人们最可能想知道的,由此产生三个问题。直接输出两个问题,不要其他解释", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "dd9fda9d1c56d01e5b3a38a4be59ec92", "modelName": "Bing", "auditProcessIndex": None, "name": "bing搜索回答", "inputConfigs": [ "task-e7ad826428c4d432f048c935de74c118-all-topAll" ], "inputFilterMatchMode": None, "inputReviewOpen": 0, "model": "Bing", "prompt": "【 {task-e7ad826428c4d432f048c935de74c118-all-topAll} 】请你根据以上内容展开搜索回答,对问题分别回答,给我具体的事实型信息。", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "c37b0763bbbe824bda42726915520aa4", "modelName": "GPT-4", "auditProcessIndex": None, "name": "理解 原文结构", "inputConfigs": [ "content|0|input1-正文-all-topAll" ], "inputFilterMatchMode": None, "inputReviewOpen": 0, "model": "GPT-4", "modelParam": None, "prompt": "请你分析文章的大结构,比如事件引入等。正文:【 {content|0|input1-正文-all-topAll} 】", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "28403a18b08241c2a07ed4122f045163", "modelName": "GPT-4", "auditProcessIndex": None, "name": "成文", "inputConfigs": [ "task-713bc86019b724007f2d81da182ba29d-all-topAll", "task-85028b8433d186b95ecfcf8cfe12e20e-all-topAll", "task-dd9fda9d1c56d01e5b3a38a4be59ec92-all-topAll", "task-c37b0763bbbe824bda42726915520aa4-all-topAll", "content|0|input1-标题-all-topAll" ], "inputFilterMatchMode": None, "inputReviewOpen": 0, "model": "GPT-4", "modelParam": None, "prompt": "标题如下:\n\"\"\"\n{content|0|input1-标题-all-topAll}\n\"\"\"\n核心事件如下:\n\"\"\"\n{task-713bc86019b724007f2d81da182ba29d-all-topAll}\n\"\"\"\n事实信息如下:\n\"\"\"\n{task-85028b8433d186b95ecfcf8cfe12e20e-all-topAll}\n\"\"\"\n可补充信息如下:\n\"\"\"\n{task-dd9fda9d1c56d01e5b3a38a4be59ec92-all-topAll}\n\"\"\"\n参考原文结构如下:\n\"\"\"\n{task-c37b0763bbbe824bda42726915520aa4-all-topAll}\n\"\"\"\n任务:请根据以上内容,在符合基础事实的情况下,生成一篇1300字左右文章。\n要求如下:\n\"\"\"\n- 直接输出文章,不需要解释。\n- 事件部分达到文章35%,可以适当加上对事件的评论。\n- 参考文章的大结构来做全文结构。\n- 表达应当客观准确,简明扼要,不需要小标题。\n\"\"", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "8966cb4c88152d3a3377ac3cc417305e", "modelName": "Kimi", "auditProcessIndex": None, "name": "titile 安全分", "inputConfigs": [ "content|0|inputAll-标题-every-topAll" ], "inputFilterMatchMode": 2, "inputReviewOpen": 0, "model": "Kimi", "prompt": "请你学习一下内容规范,以下标题可能会违反了某条内容规范。请你对标题做一个内容风险评级,1-10分,等级越高内容违规风险越大。\n请直接输出内容风险评级的分数,不要输出你的理由、分析等内容。\n\n标题为: {content|0|inputAll-标题-every-topAll} \n\n\n\n内容规范为:\n\n4.2 色俗内容\n4.2.1 散布淫秽、色情内容,包括但不限于招嫖、寻找一夜情、性伴侣等。\n4.2.2 发布有色情意味的情色文字、情色视频、情色漫画等内容。\n4.2.3 以投稿/爆料等形式描述约炮经历、性交体验、偷情、涉隐私部位偷拍等伤风败俗的话题内容。\n4.2.4 以低俗的配图引诱用户阅读文章、关注微信公众号。包含性撩拨、性挑逗画面;疑似女性性高潮/性虐场面;偷拍的沐浴/更衣/如厕/亲热等私密画面;女性故意露出敏感部位 (纯裸露的胸、生殖器官)以及敏感部位未打码的真人写真/艺术摄影等。\n4.2.5 文内以低俗类的动图或引导图,诱导用户点击进而跳转至另一篇图文页或关注某个公众号。\n4.2.6 文章主要描述PUA撩妹、撩汉等相关话题,且引导用户关注公众号/加个人微信号/加群。\n\n4.11 煽动、夸大、误导类内容\n平台鼓励创作者提供准确、清晰、能体现文章内容主旨的标题,不允许通过标题噱头诱导用户点击或误导用户。包括但不限于以下情况:\n4.11.1 标题含有危害人身安全、恐吓侮辱、惊悚、极端内容,或者以命令式语气强迫用户阅读。\n4.11.2 标题无依据夸大事件严重程度、紧急程度、受影响面以及事件引发的情绪。\n4.11.3 标题以浮夸的描述,反常识强调某种食物/行为对人体健康的影响,煽动人群要/不要去做某行为。\n4.11.4 非官方通知或者公告,但标题假借官方名义煽动获取流量,或以信息来源机密、看完即删来诱导用户。\n4.11.5 标题故意隐藏关键信息,或无中生有部分信息,给用户造成误导。\n\n4.12 违反国家法律法规禁止的内容\n(1)违反宪法确定的基本原则的;\n(2)危害国家安全,泄露国家秘密,颠覆国家政权,破坏国家统一的;\n(3)损害国家荣誉和利益的;\n(4)煽动民族仇恨、民族歧视,破坏民族团结的;\n(5)破坏国家宗教政策,宣扬邪教和封建迷信的;\n(6)散布不实信息,扰乱社会秩序,破坏社会稳定的;\n(7)散布淫秽、色情、赌博、暴力、恐怖或者教唆犯罪的;\n(8)侮辱或者诽谤他人,侵害他人合法权益的;\n(9)煽动非法集会、结社、游行、示威、聚众扰乱社会秩序;\n(10)以非法民间组织名义活动的;\n(11)不符合《即时通信工具公众信息服务发展管理暂行规定》及遵守法律法规、社会主义制度、国家利益、公民合法利益、公共秩序、社会道德风尚和信息真实性等“七条底线”要求的;\n(12)含有法律、行政法规禁止的其他内容的。", "auditProcessOpen": 0, "modelOperation": 1, "modelOperationName": "生文", "exeType": 1, "outputType": 1, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "ad66503e0cfb1dd18df9b8697156ed01", "modelName": "去除图片水印", "auditProcessIndex": None, "name": "封面去水印", "inputConfigs": [ "content|0|inputAll-封面图-every-topAll" ], "inputFilterMatchMode": 2, "inputReviewOpen": 0, "model": "remove_logo", "auditProcessOpen": 0, "modelOperation": 509, "modelOperationName": "公众号", "exeType": 2, "outputType": 3, "ext": None }, { "taskFunctionId": None, "taskFunctionTaskId": None, "taskFunctionUseType": 0, "taskId": "bad7562d16c070ba488b9a64bdf8af67", "modelName": "去除图片水印", "auditProcessIndex": None, "name": "图片去水印", "inputConfigs": [ "content|0|inputAll-图集-every-topAll" ], "inputFilterMatchMode": 2, "inputReviewOpen": 0, "model": "remove_logo", "auditProcessOpen": 0, "modelOperation": 509, "modelOperationName": "公众号", "exeType": 2, "outputType": 3, "ext": None }, { "taskType": 4, "taskId": "94646f3a12be411d31dd4f8a671126d6", "exeType": 2, "open": True, "ext": "{\"wordCountRule\":\"wx_gzh\",\"operator\":\"大于\",\"limit\":\"1000\"}", "model": "GPT-4", "prompt": "扩写成为1300字左右文章,在符合事实和原有故事情节的基础上,按自然段落形式展开,有清晰的结构。不要出现字数或总结的说明,请直接输出文章\n\n正文为:{正文}", "retryMaxCount": 3 } ], "layoutType": 1, "activeManualReviewCount": 1, "id": "20240723085507877294360" }, "baseInfo": cls.person_info }) response = requests.request("POST", url, headers=cls.headers, data=payload) print(response.text) @classmethod def getProducePlanDetail(cls, plan_id): """ 通过生成计划id,获取生成计划详情 :param plan_id: :return: """ url = "http://aigc-api.cybertogether.net/aigc/produce/plan/detail" payload = { "params": { "id": plan_id }, "baseInfo": cls.person_info } response = requests.request( "POST", url, headers=cls.headers, data=json.dumps(payload) ) return response.json()