goldfishh / chatgpt-tool-hub

An open-source chatgpt tool ecosystem where you can combine tools with chatgpt and use natural language to do anything.
MIT License
1.19k stars 157 forks source link

大佬求教,配置news的api不成功 #38

Open dwd923 opened 1 year ago

dwd923 commented 1 year ago

前置确认

1. 网络能够访问openai接口
2. git pull 拉取最新代码
3. 执行pip install -r requirements.txt,检查依赖是否满足
4. 在已有 issue 中未搜索到类似问题

求教各位大佬,news配置一直不成功,相关配置文件和返回结果如下,求教!

config.json文件如下: { "tools": ["python", "url-get", "terminal", "meteo-weather", "wikipedia", "bing-search", "news", "morning-news" ], "kwargs": { "debug": true, "request_timeout": 120,
"no_default": false, "bing_subscription_key": "5779454a6axxxxxd4d4b8e3270", "news_api_key": "e8932ac5b3xxxxxx706c4aff8aa5061", "morning_news_api_key": "lyI2xxxxxpJ5jW" } }

后台报错链接如下:https://newsapi.org/v2/top-headlines?pageSize=2&page=1 打开链接后结果如下:{"status":"error","code":"apiKeyMissing","message":"Your API key is missing. Append this to the URL with the apiKey param, or use the x-api-key HTTP header."}

dkman11 commented 1 year ago

您好,能请教下如何使用tool吗?我修改了chatgpt-on-wechat/plugins/tool/config。json,能聊天但是无法使用tool

dwd923 commented 1 year ago

您好,能请教下如何使用tool吗?我修改了chatgpt-on-wechat/plugins/tool/config。json,能聊天但是无法使用tool

你需要确保你的tool插件已经启动。程序运行后,在微信端输入#auth +你的密码 然后提示认证成功后,输入#plist,查看你目前的插件列表

qq460046000 commented 1 year ago

怎么在chatgpt-on-wechat使用tool啊???

dkman11 commented 1 year ago

您好,能请教下如何使用tool吗?我修改了chatgpt-on-wechat/plugins/tool/config。json,能聊天但是无法使用tool

你需要确保你的tool插件已经启动。程序运行后,在微信端输入#auth +你的密码 然后提示认证成功后,输入#plist,查看你目前的插件列表

感谢已经成功🙏

dkman11 commented 1 year ago

怎么在chatgpt-on-wechat使用tool啊???

去看issues里第二个我的提问,里面有大佬解答

goldfishh commented 1 year ago

https://newsapi.org/v2/top-headlines?pageSize=2&page=1

试一试#help tool 已加载的工具有哪些? 有news-api 这个工具吗?

另外能否提供完整的日志方便定位问题?

dwd923 commented 1 year ago

https://newsapi.org/v2/top-headlines?pageSize=2&page=1

试一试#help tool 已加载的工具有哪些? 有news-api 这个工具吗?

另外能否提供完整的日志方便定位问题?

加载的工具有news,突然想到一个问题,这个插件是否依赖代理?因为我是直接改的openai的库,没有在本项目中设置代理

dwd923 commented 1 year ago

日志如下: [INFO][2023-04-27 09:50:44][victorinox.py:85] - 提问: 用news给我查一条美国的新闻,并告诉我内容 [INFO][2023-04-27 09:50:48][base.py:107] - 执行Tool: news中... [INFO][2023-04-27 09:50:48][bot.py:91] - 输入: 查一条美国的新闻 [INFO][2023-04-27 09:50:51][base.py:132] - 执行Tool: news-api中... [INFO][2023-04-27 09:50:51][bot.py:91] - 输入: What are the top headlines in the United States? [DEBUG][2023-04-27 09:50:54][base.py:69] - [API] generate url: https://newsapi.org/v2/top-headlines?country=us&pageSize=2&page=1 [DEBUG][2023-04-27 09:50:56][base.py:74] - [API] response: {"status":"ok","totalResults":36,"articles":[{"source":{"id":"cnn","name":"CNN"},"author":"Heather Chen","title":"Singapore executes man for trafficking two pounds of cannabis - CNN","description":"A Singaporean man convicted of trying to traffic around 2.2 pounds of cannabis was executed on Wednesday, his family confirmed to CNN, a sentence lambasted by rights groups and campaigners for its severity at a time when many other nations, including neighbor…","url":"https://www.cnn.com/2023/04/25/asia/singapore-cannabis-execution-tangaraju-suppiah-intl-hnk/index.html","urlToImage":"https://media.cnn.com/api/v1/images/stellar/prod/230425003415-02-singapore-cannabis-execution.jpg?c=16x9&q=w_800,c_fill","publishedAt":"2023-04-26T02:16:00Z","content":"A Singaporean man convicted of trying to traffic around 2.2 pounds of cannabis was executed on Wednesday, his family confirmed to CNN, a sentence lambasted by rights groups and campaigners for its se… [+6899 chars]"},{"source":{"id":null,"name":"BBC News"},"author":"https://www.facebook.com/bbcnews","title":"iSpace: Japanese Moon lander likely to have crashed - BBC","description":"Communication was lost with Japan's Hakuto-R lunar moments before it was due to touch down.","url":"https://www.bbc.com/news/world-asia-65389730","urlToImage":"https://ichef.bbci.co.uk/news/1024/branded_news/181F0/production/_129500889_mediaitem129500888.jpg","publishedAt":"2023-04-26T01:51:20Z","content":"A Japanese company hoping to carry out a rare private Moon landing says it is likely its lunar lander crashed on the surface. \r\nCommunication was lost with Hakuto-R moments before it was due to touch… [+2730 chars]"}]} [DEBUG][2023-04-27 09:51:12][tool_engine.py:139] - llm received: 'Based on the API response, it seems that the API call did not provide the top headlines in the United States as requested in the question. Instead, it returned two articles, one about a Singaporean man executed for drug trafficking and another about a Japanese company\'s failed attempt at a private Moon landing. \n\nTo generate the API url for the question, I used the provided API documentation which specifies the endpoint for top headlines and includes a parameter for country set to "us" to filter for news in the United States. I also set the pageSize parameter to 2 to limit the number of articles returned and the page parameter to 1 to retrieve the first page of results. \n\nHowever, it seems that the API response did not provide the expected information to answer the question. It is possible that the API call needs to be modified to include additional parameters or filters to specifically retrieve the top headlines in the United States.' from [news-api] [INFO][2023-04-27 09:51:12][tool_engine.py:169] - [news-api]输出: Based on the API response, it seems that the API call did not provide the top headlines in the United States as requested in the question. Instead, it returned two articles, one about a Singaporean man executed for drug trafficking and another about a Japanese company's failed attempt at a private Moon landing.

To generate the API url for the question, I used the provided API documentation which specifies the endpoint for top headlines and includes a parameter for country set to "us" to filter for news in the United States. I also set the pageSize parameter to 2 to limit the number of articles returned and the page parameter to 1 to retrieve the first page of results.

However, it seems that the API response did not provide the expected information to answer the question. It is possible that the API call needs to be modified to include additional parameters or filters to specifically retrieve the top headlines in the United States. [INFO][2023-04-27 09:51:17][base.py:132] - 执行Tool: finance-news中... [INFO][2023-04-27 09:51:17][bot.py:91] - 输入: Access the finance-news tool to search for recent news articles about the United States. [ERROR][2023-04-27 09:51:17][victorinox.py:88] - [APP] catch a Exception: 1 validation error for ChromeBrowser root Proxy URL had no scheme, should start with http:// or https:// (type=assertion_error) [DEBUG][2023-04-27 09:51:17][victorinox.py:111] - Now memory: [] [INFO][2023-04-27 09:51:17][victorinox.py:85] - 提问: 用news给我查一条美国的新闻,并告诉我内容 [INFO][2023-04-27 09:51:21][base.py:107] - 执行Tool: news中... [INFO][2023-04-27 09:51:21][bot.py:91] - 输入: 查一条美国的新闻 [INFO][2023-04-27 09:51:24][base.py:132] - 执行Tool: news-api中... [INFO][2023-04-27 09:51:24][bot.py:91] - 输入: What are the top headlines in the United States? [DEBUG][2023-04-27 09:51:26][base.py:69] - [API] generate url: https://newsapi.org/v2/top-headlines?country=us [DEBUG][2023-04-27 09:51:27][base.py:74] - [API] response: {"status":"ok","totalResults":36,"articles":[{"source":{"id":"cnn","name":"CNN"},"author":"Heather Chen","title":"Singapore executes man for trafficking two pounds of cannabis - CNN","description":"A Singaporean man convicted of trying to traffic around 2.2 pounds of cannabis was executed on Wednesday, his family confirmed to CNN, a sentence lambasted by rights groups and campaigners for its severity at a time when many other nations, including neighbor…","url":"https://www.cnn.com/2023/04/25/asia/singapore-cannabis-execution-tangaraju-suppiah-intl-hnk/index.html","urlToImage":"https://media.cnn.com/api/v1/images/stellar/prod/230425003415-02-singapore-cannabis-execution.jpg?c=16x9&q=w_800,c_fill","publishedAt":"2023-04-26T02:16:00Z","content":"A Singaporean man convicted of trying to traffic around 2.2 pounds of cannabis was executed on Wednesday, his family confirmed to CNN, a sentence lambasted by rights groups and campaigners for its se… [+6899 chars]"},{"source":{"id":null,"name":"BBC News"},"author":"https://www.facebook.com/bbcnews","title":"iSpace: Japanese Moon lander likely to have crashed - BBC","description":"Communication was lost with Japan's Hakuto-R lunar moments before it was due to touch down.","url":"https://www.bbc.com/news/world-asia-65389730","urlToImage":"https://ichef.bbci.co.uk/news/1024/branded_news/181F0/production/_129500889_mediaitem129500888.jpg","publishedAt":"2023-04-26T01:51:20Z","content":"A Japanese company hoping to carry out a rare private Moon landing says it is likely its lunar lander crashed on the surface. \r\nCommunication was lost with Hakuto-R moments before it was due to touch… [+2730 chars]"},{"source":{"id":"the-washington-post","name":"The Washington Post"},"author":"Dan Lamothe","title":"Mastermind of Kabul airport massacre killed by Taliban, U.S. says - The Washington Post","description":"An ISIS suicide bomber killed scores of Afghans and 13 U.S. troops during the Biden administration’s evacuation of Afghanistan in 2021.","url":"https://www.washingtonpost.com/national-security/2023/04/25/kabul-airport-bombing-mastermind-killed/","urlToImage":"https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/JAUBGZAQZEI6ZOWKQ2YUJ7EKFU.jpg&w=1440","publishedAt":"2023-04-26T00:39:00Z","content":"Comment on this story\r\nComment\r\nThe suspected mastermind of a gruesome suicide bombing during the United States pullout from Afghanistan was killed by the Taliban in recent weeks, U.S. officials disc… [+8212 chars]"},{"source":{"id":null,"name":"Phys.Org"},"author":"Science X","title":"Astronomers solve the 60-year mystery of quasars, the most powerful objects in the universe - Phys.org","description":"Scientists have unlocked one of the biggest mysteries of quasars—the brightest, most powerful objects in the universe—by discovering that they are ignited by galaxies colliding.","url":"https://phys.org/news/2023-04-astronomers-year-mystery-quasars-powerful.html","urlToImage":"https://scx2.b-cdn.net/gfx/news/hires/2023/astronomers-solve-the.jpg","publishedAt":"2023-04-26T00:01:04Z","content":"Scientists have unlocked one of the biggest mysteries of quasarsthe brightest, most powerful objects in the universeby discovering that they are ignited by galaxies colliding.\r\nFirst discovered 60 ye… [+3858 chars]"},{"source":{"id":null,"name":"Pro Football Network"},"author":null,"title":"3-Round 2023 NFL Mock Draft: Rodgers Trade Has Ripple Effect, Will Anderson Goes Second and C.J. Stroud Is a Titan - Pro Football Network","description":"With the fallout from the Aaron Rodgers trade to the Jets, how does the NFL Draft change? This 3-Round 2023 NFL Mock Draft explores how.","url":"https://www.profootballnetwork.com/3-round-2023-nfl-mock-draft-rodgers-trade-will-anderson-cj-stroud-titans/","urlToImage":"https://www.profootballnetwork.com/wp-content/uploads/2023/04/3-round-2023-nfl-mock-draft-rodgers-trade-will-anderson-cj-stroud-titans.jpg","publishedAt":"2023-04-26T00:00:30Z","content":"With the end of the drafts silly season — full of rumors and chaos — were finally getting boards settled in and draft evaluations done. Now, the gossip about which players are at the top of various t… [+29982 chars]"},{"source":{"id":null,"name":"The Guardian"},"author":"Guardian staff reporter","title":"First Republic Bank shares fall 50% after reporting dramatic slump in deposits - The Guardian","description":"Bank now faces tough options to turn around its business with the creation of a ‘bad bank’ or asset sales possibilities","url":"https://www.theguardian.com/business/2023/apr/25/first-republic-bank-shares-fall","urlToImage":"https://i.guim.co.uk/img/media/ebeb65147c2ce9139060fe440fa531bc12a04ca3/0_342_8256_4954/master/8256.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=3fb056d58902bfae7701341f22e82d15","publishedAt":"2023-04-25T23:57:00Z","content":"First Republic Banks shares closed down 50% on Tuesday, a day after the mid-sized US bank announced a dramatic slump in deposits.\r\nOn Monday the San Francisco-headquartered reported a more than $100b… [+3713 chars]"},{"source":{"id":null,"name":"CBS Sports"},"author":"","title":"Aaron Rodgers bids farewell to Packers in social media post following blockbuster trade to Jets - CBS Sports","description":"Rodgers will be formally introduced by New York on Wednesday","url":"https://www.cbssports.com/nfl/news/aaron-rodgers-bids-farewell-to-packers-in-social-media-post-following-blockbuster-trade-to-jets/","urlToImage":"https://sportshub.cbsistatic.com/i/r/2023/02/23/b4c38793-bedb-4f88-8fec-eab8c2c27987/thumbnail/1200x675/c48d40bde436b130624093a443fcb0ed/aaron-rodgers.jpg","publishedAt":"2023-04-25T23:27:02Z","content":"Aaron Rodgers has bid Green Bay farewell. A day after the news came down that the Packers and Jetsagreed to terms to send the four-time NFL MVP to New York and put an end to his near-two-decade run w… [+2147 chars]"},{"source":{"id":"cnn","name":"CNN"},"author":"Rob Picheta,Mostafa Salem,Celine Alkhaldi,Brent Swails,Lianne Kolirin","title":"WHO warns of 'biological risk' after Sudan fighters seize lab, as violence mars US-brokered ceasefire - CNN","description":"The World Health Organization warned Tuesday of a \"huge biological risk\" after Sudanese fighters seized the National Public Health Laboratory in the capital Khartoum, as foreign nations raced to mount rapid evacuation efforts from the country and violence pun…","url":"https://www.cnn.com/2023/04/25/africa/sudan-evacuations-ceasefire-intl/index.html","urlToImage":"https://media.cnn.com/api/v1/images/stellar/prod/230424112109-05-sudan-evacuations.jpg?c=16x9&q=w_800,c_fill","publishedAt":"2023-04-25T23:15:00Z","content":"The World Health Organization warned Tuesday of a huge biological risk after Sudanese fighters seized the National Public Health Laboratory in the capital Khartoum, as foreign nations raced to mount �� [+7915 chars]"},{"source":{"id":null,"name":"YouTube"},"author":null,"title":"Here's what happened on the first day of the rape allegation civil trial against Trump - CNN","description":"The civil battery and defamation trial for columnist E. Jean Carroll against former President Donald Trump has started. CNN’s Wolf Blitzer discusses the late...","url":"https://www.youtube.com/watch?v=Z8SzZYV1dy8","urlToImage":"https://i.ytimg.com/vi/Z8SzZYV1dy8/maxresdefault.jpg","publishedAt":"2023-04-25T22:48:18Z","content":null},{"source":{"id":null,"name":"New York Post"},"author":"Patrick Reilly","title":"Washington State Gov. Jay Inslee signs bill banning assault weapons: 'No one needs an AR-15' - New York Post ","description":"“No one needs an AR-15 to protect your family,” Inslee said while surrounded by family members of shooting victims. “You only need it to kill other families.”","url":"https://nypost.com/2023/04/25/washington-becomes-10th-state-to-ban-assault-weapons-no-one-needs-an-ar-15/","urlToImage":"https://nypost.com/wp-content/uploads/sites/2/2023/04/NYPICHPDPICT000010141335.jpg?quality=75&strip=all&w=1024","publishedAt":"2023-04-25T22:36:00Z","content":"Washington Governor Jay Inslee on Tuesday signed a bill that bans the manufacture, purchase and import of assault-style weapons. \r\nInsee said in a statement that a second piece of gun safety legislat… [+2782 chars]"},{"source":{"id":"ars-technica","name":"Ars Technica"},"author":"Beth Mole","title":"Crazy variability of melatonin in sleep aid gummies may keep you up at night - Ars Technica","description":"JAMA study highlights quality control issues common in dietary supplements.","url":"https://arstechnica.com/science/2023/04/crazy-variability-of-melatonin-in-sleep-aid-gummies-may-keep-you-up-at-night/","urlToImage":"https://cdn.arstechnica.net/wp-content/uploads/2023/04/GettyImages-143194340-760x380.jpeg","publishedAt":"2023-04-25T22:33:53Z","content":"80 with \r\nAn eye-opening analysis of common, over-the-counter sleep aids finds they contain wildly variable amounts of melatonin, with some packing up to 347 percent of the amount on the label.\r\nThe … [+3738 chars]"},{"source":{"id":"entertainment-weekly","name":"Entertainment Weekly"},"author":"Emlyn Travis","title":"Morgan Wallen sued by concertgoer after canceling show minutes before showtime - Entertainment Weekly News","description":"The class-action lawsuit was subsequently withdrawn in Mississippi federal court, but attorney Casey Lott has pledged to refile.","url":"https://ew.com/music/morgan-wallen-sued-by-concertgoer-after-canceling-show/","urlToImage":"https://imagesvc.meredithcorp.io/v3/mm/image?q=60&c=sc&poi=%5B940%2C266%5D&w=2000&h=1000&url=https%3A%2F%2Fstatic.onecms.io%2Fwp-content%2Fuploads%2Fsites%2F6%2F2023%2F04%2F25%2Fmorgan-wallen-cancelled-show-042523-1.jpg","publishedAt":"2023-04-25T22:27:00Z","content":"Country musician Morgan Wallen could find himself singing the blues.\r\nOn Sunday, the \"Thought You Should Know\" singer suddenly canceled his performance minutes before he was set to perform at the Vau… [+3089 chars]"},{"source":{"id":null,"name":"Billboard"},"author":"Hannah Dailey","title":"Taylor Swift Fans Honor Swiftie Killed by Suspected Drunk Driver With Friendship Bracelets & GoFundMe - Billboard","description":"“Long Live Jacob!! You will be Remembered!!” wrote one Swiftie.","url":"https://www.billboard.com/music/music-news/taylor-swift-swiftie-killed-truck-driver-friendship-bracelet-gofundme-1235314752/","urlToImage":"https://www.billboard.com/wp-content/uploads/2023/04/03-taylor-swift-eras-tour-houston-billboard-1548.jpg?w=1024","publishedAt":"2023-04-25T22:21:04Z","content":"Swifties are teaming up to pay tribute to one of their own. Following the devastating news that a 20-year-old Taylor Swift fan named Jacob Lewis was killed by a suspected drunk driver while on his wa… [+3053 chars]"},{"source":{"id":"associated-press","name":"Associated Press"},"author":"Zeke Miller","title":"President Joe Biden announces 2024 reelection bid - The Associated Press","description":"President Joe Biden has formally announced he's running for reelection in 2024. The Democratic president is asking voters to give him more time to “finish the job” he began when he was sworn in to office and set aside their concerns about extending the run of…","url":"https://apnews.com/article/joe-biden-election-2024-president-democrats-trump-9c72115656855da89a41cac3f79aa65b","urlToImage":"https://storage.googleapis.com/afs-prod/media/05ea342490294812a9f280d1e49cdf9f/3000.webp","publishedAt":"2023-04-25T22:10:09Z","content":"WASHINGTON (AP) President Joe Biden on Tuesday formally announced that he is running for reelection in 2024, asking voters to give him more time to finish this job and extend the run of Americas olde… [+9358 chars]"},{"source":{"id":"the-washington-post","name":"The Washington Post"},"author":"Meryl Kornfield","title":"5 facts about Julie Chavez Rodriguez, Biden's 2024 campaign manager - The Washington Post","description":"Julie Chavez Rodriguez, who will run the Biden-Harris 2024 reelection bid, is the granddaughter of legendary labor leader Cesar Chavez.","url":"https://www.washingtonpost.com/politics/2023/04/25/julie-chavez-rodriguez-biden-2024-campaign/","urlToImage":"https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/4NPAWWHCEQI63FUWR2DU7VYQXA_size-normalized.jpg&w=1440","publishedAt":"2023-04-25T22:05:00Z","content":"Return to menuIn 2008, Patti Solis Doyle, whose parents were Mexican immigrants, made history as the first Latina campaign manager when she took the helm of Hillary Clintons presidential bid. But Sol… [+1084 chars]"},{"source":{"id":null,"name":"Fox Business"},"author":"Bradford Betz","title":"Apple developing AI-powered health coaching service, emotional tracking tools: report - Fox Business","description":"Apple is said to be developing a new A.I.-powered health coaching service to motivate users to exercise as well as new tools to track users' emotional health.","url":"https://www.foxbusiness.com/technology/apple-developing-ai-powered-health-coaching-service-emotional-tracking-tools-report","urlToImage":"https://a57.foxnews.com/static.foxbusiness.com/foxbusiness.com/content/uploads/2023/04/0/0/AI-Health.jpg?ve=1&tl=1","publishedAt":"2023-04-25T21:42:23Z","content":"Apple is reportedly developing an A.I.-powered health coaching service and tools to track the emotional health of users. \r\nPeople familiar with the plans told Bloomberg the intent of the coaching ser… [+1547 chars]"},{"source":{"id":"cnn","name":"CNN"},"author":"Veronica Miracle,Cheri Mossburg,Phil Gast","title":"Man accused of killing Cash App founder Bob Lee intends to plead not guilty next week, his attorney says - CNN","description":"Nima Momeni, the man accused of killing Cash App founder Bob Lee in San Francisco, intends to plead not guilty next week, his attorney said.","url":"https://www.cnn.com/2023/04/25/tech/cash-app-bob-lee-killing-arraignment/index.html","urlToImage":"https://media.cnn.com/api/v1/images/stellar/prod/230421063504-bob-lee-cash-app-california-file-restricted-040723.jpg?c=16x9&q=w_800,c_fill","publishedAt":"2023-04-25T21:20:00Z","content":"Nima Momeni, the man accused of killing Cash App founder Bob Lee in San Francisco, intends to plead not guilty next week, his attorney said.\r\nMomeni was to be arraigned on a murder charge Tuesday but… [+7420 chars]"},{"source":{"id":"bloomberg","name":"Bloomberg"},"author":"Lu Wang","title":"Quants Are 'Out of Ammo' for Buying Stocks, Goldman Warns - Bloomberg","description":"Amid resurgent banking angst, rattled stock markets may have to live without a key source of buying power.","url":"https://www.bloomberg.com/news/articles/2023-04-25/goldman-s-rubner-warns-quants-out-of-ammo-for-buying-stocks","urlToImage":"https://assets.bwbx.io/images/users/iqjWHBFdfxIU/i4lDdUyDrzXg/v0/1200x798.jpg","publishedAt":"2023-04-25T21:06:58Z","content":"Amid resurgent banking angst, rattled stock markets may have to live without a key source of buying power.\r\nThat’s the warning from Goldman Sachs Group Inc.’s Scott Rubner, whose data show systematic… [+164 chars]"},{"source":{"id":"cnn","name":"CNN"},"author":"","title":"RNC responds to Biden's reelection bid with AI-generated ad - CNN","description":"The Republican National Committee responded to President Biden's reelection announcement with an AI-generated video. CNN's Jon Sarlin reports on AI's role in politics and future campaigns.","url":"https://www.cnn.com/videos/politics/2023/04/25/artificial-intelligence-rnc-response-biden-campaign-cnn-vpx.cnn","urlToImage":"https://media.cnn.com/api/v1/images/stellar/prod/230425130213-rnc-ai-images.jpg?c=16x9&q=w_800,c_fill","publishedAt":"2023-04-25T20:57:10Z","content":null},{"source":{"id":null,"name":"YouTube"},"author":null,"title":"INCONCEIVABLE! - Perk's word to describe Jimmy Butler's 56-PT night | NBA Today - ESPN","description":"INCONCEIVABLE! - Perk's word to describe Jimmy Butler's 56-PT night | NBA TodayThe NBA Today crew react to Jimmy Butler dropping 56 points on the Bucks in Ga...","url":"https://www.youtube.com/watch?v=KbruDZ8RfNI","urlToImage":"https://i.ytimg.com/vi/KbruDZ8RfNI/maxresdefault.jpg","publishedAt":"2023-04-25T20:52:18Z","content":null}]} [ERROR][2023-04-27 09:51:27][victorinox.py:88] - [APP] catch a Exception: This model's maximum context length is 4097 tokens. However, your messages resulted in 4612 tokens. Please reduce the length of the messages. [ERROR][2023-04-27 09:51:27][victorinox.py:92] - exceed retry_num [ERROR][2023-04-27 09:51:27][tool.py:108] - 超过重试次数 Traceback (most recent call last): File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/apps/victorinox.py", line 86, in ask return self.bot.run(query) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 212, in run return self(args[0])[self.output_keys[0]] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 115, in call raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 112, in call outputs = self._call(inputs) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 158, in _call next_step_output = self._take_next_step( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 123, in _take_next_step observation = tool.run( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 72, in run raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 69, in run observation = self._run(tool_input) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/news/tool.py", line 45, in _run return parent_bot_prefix + self.bot.run(query) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 212, in run return self(args[0])[self.output_keys[0]] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 115, in call raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 112, in call outputs = self._call(inputs) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 158, in _call next_step_output = self._take_next_step( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 123, in _take_next_step observation = tool.run( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 72, in run raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 69, in run observation = self._run(tool_input) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/news/finance_news/tool.py", line 28, in _run _response = BrowserTool().run(self.jin10_url) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/web_requests/browser.py", line 127, in init self.browser = ChromeBrowser() File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 1 validation error for ChromeBrowser root Proxy URL had no scheme, should start with http:// or https:// (type=assertion_error)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/apps/victorinox.py", line 86, in ask return self.bot.run(query) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 212, in run return self(args[0])[self.output_keys[0]] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 115, in call raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 112, in call outputs = self._call(inputs) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 158, in _call next_step_output = self._take_next_step( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 123, in _take_next_step observation = tool.run( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 72, in run raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 69, in run observation = self._run(tool_input) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/news/tool.py", line 45, in _run return parent_bot_prefix + self.bot.run(query) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 212, in run return self(args[0])[self.output_keys[0]] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 115, in call raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 112, in call outputs = self._call(inputs) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 158, in _call next_step_output = self._take_next_step( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/engine/tool_engine.py", line 123, in _take_next_step observation = tool.run( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 72, in run raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/base_tool.py", line 69, in run observation = self._run(tool_input) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/tools/news/news_api/tool.py", line 40, in _run return self.api_chain.run(query) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 212, in run return self(args[0])[self.output_keys[0]] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 115, in call raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 112, in call outputs = self._call(inputs) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/api/base.py", line 81, in _call answer = self.api_answer_chain.predict( File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/llm.py", line 151, in predict return self(kwargs)[self.output_key] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 115, in call raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/base.py", line 112, in call outputs = self._call(inputs) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/llm.py", line 57, in _call return self.apply([inputs])[0] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/llm.py", line 118, in apply response = self.generate(input_list) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/chains/llm.py", line 62, in generate return self.llm.generate_prompt(prompts, stop) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/models/chatgpt/base.py", line 78, in generate_prompt raise e File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/models/chatgpt/base.py", line 75, in generate_prompt output = self.generate(prompt_messages, stop=stop) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/models/chatgpt/base.py", line 52, in generate results = [self._generate(m, stop=stop) for m in messages] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/models/chatgpt/base.py", line 52, in results = [self._generate(m, stop=stop) for m in messages] File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/models/chatgpt/chatgpt.py", line 274, in _generate response = self.completion_with_retry(messages=message_dicts, params) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/models/chatgpt/chatgpt.py", line 234, in completion_with_retry return _completion_with_retry(kwargs) File "/wechatgpt/lib/python3.10/site-packages/tenacity/init.py", line 289, in wrapped_f return self(f, *args, kw) File "/wechatgpt/lib/python3.10/site-packages/tenacity/init.py", line 379, in call do = self.iter(retry_state=retry_state) File "/wechatgpt/lib/python3.10/site-packages/tenacity/init.py", line 314, in iter return fut.result() File "/usr/bin/python3.10/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.get_result() File "/usr/bin/python3.10/lib/python3.10/concurrent/futures/_base.py", line 403, in get_result raise self._exception File "/wechatgpt/lib/python3.10/site-packages/tenacity/init.py", line 382, in call result = fn(args, kwargs) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/models/chatgpt/chatgpt.py", line 232, in _completion_with_retry return self.client.create(kwargs) File "/wechatgpt/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create return super().create(args, kwargs) File "/wechatgpt/lib/python3.10/site-packages/openai/api_resources/abstract/engine_apiresource.py", line 153, in create response, , api_key = requestor.request( File "/wechatgpt/lib/python3.10/site-packages/openai/api_requestor.py", line 226, in request resp, got_stream = self._interpret_response(result, stream) File "/wechatgpt/lib/python3.10/site-packages/openai/api_requestor.py", line 619, in _interpret_response self._interpret_response_line( File "/wechatgpt/lib/python3.10/site-packages/openai/api_requestor.py", line 682, in _interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens. However, your messages resulted in 4612 tokens. Please reduce the length of the messages.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/gpt/chatgpt-on-wechat/plugins/tool/tool.py", line 104, in on_handle_context _reply = self.app.ask(query, user_session) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/apps/victorinox.py", line 90, in ask return self.ask(query, chat_history, retry_num + 1) File "/wechatgpt/lib/python3.10/site-packages/chatgpt_tool_hub/apps/victorinox.py", line 93, in ask raise TimeoutError("超过重试次数") TimeoutError: 超过重试次数 [ERROR][2023-04-27 09:51:27][tool.py:109] - 超过重试次数 [INFO][2023-04-27 09:51:27][chat_gpt_bot.py:48] - [CHATGPT] query=请你随机用一种聊天风格,提醒用户:这个问题tool插件暂时无法处理 [INFO][2023-04-27 09:51:38][wechatcomapp_channel.py:63] - [wechatcom] Do send text to DongWenDa: 嗨,很抱歉告诉您,我们的chat tool似乎无法处理您的请求。这可能是由于一些技术问题,我们将尽快修复它,以便您能够得到满意的答案。但是,我们仍然有很多其他问题需要回答,您可以随时向我们提出!非常感谢您对我们的支持和耐心等待。

goldfishh commented 1 year ago

https://newsapi.org/v2/top-headlines?pageSize=2&page=1

试一试#help tool 已加载的工具有哪些? 有news-api 这个工具吗? 另外能否提供完整的日志方便定位问题?

加载的工具有news,突然想到一个问题,这个插件是否依赖代理?因为我是直接改的openai的库,没有在本项目中设置代理

你好,tool-hub内部封装了openai,如果你手动改了openai库那么也需要在tool-hub中修改,最好的方式是设置proxy

Kevin-free commented 1 year ago

前置确认

1. 网络能够访问openai接口
2. git pull 拉取最新代码
3. 执行pip install -r requirements.txt,检查依赖是否满足
4. 在已有 issue 中未搜索到类似问题

求教各位大佬,news配置一直不成功,相关配置文件和返回结果如下,求教!

config.json文件如下: { "tools": ["python", "url-get", "terminal", "meteo-weather", "wikipedia", "bing-search", "news", "morning-news" ], "kwargs": { "debug": true, "request_timeout": 120, "no_default": false, "bing_subscription_key": "5779454a6axxxxxd4d4b8e3270", "news_api_key": "e8932ac5b3xxxxxx706c4aff8aa5061", "morning_news_api_key": "lyI2xxxxxpJ5jW" } }

后台报错链接如下:https://newsapi.org/v2/top-headlines?pageSize=2&page=1 打开链接后结果如下:{"status":"error","code":"apiKeyMissing","message":"Your API key is missing. Append this to the URL with the apiKey param, or use the x-api-key HTTP header."}

请问解决了吗? 我也是这个问题,$tool news 怎么用啊