XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

feat: integrate Pollinations AI enhancements and simplify gpt4free references

- Replaced the large GitHub project stats table in `README.md` with summaries and logos for Pollinations AI and MoneyPrinter V2 - Introduced `STATIC_URL` and `DIST_DIR` constants in new `g4f/constants.py` and used them across multiple files - Updated `PollinationsAI.py` to support conversation title and follow-up generation using tool calls - Modified `PollinationsAI.py` and `PollinationsImage.py` to use `STATIC_URL` for the `referrer` header - Enhanced `PollinationsAI.stream_complete` to yield `ToolCalls`, `TitleGeneration`, and `SuggestedFollowups` - Added `ToolCalls` handling in `client/__init__.py` to support non-stream and stream modes - Updated `ChatCompletionDelta` model in `client/stubs.py` to support `ToolCalls` - Modified `HarProvider` to merge `DEFAULT_HEADERS` into request headers - Improved `OpenaiChat.py` by adding optional chaining to page evaluation expressions for robustness - Updated `any_provider.py` to force use of `PollinationsAI` if `tools` key is present in kwargs - Refactored `is_content` into a reusable function in `providers/response.py` and used in `retry_provider.py` - Updated `gui/server/website.py` to use `STATIC_URL` and simplify `GPT4FREE_URL` handling - Removed redundant constants from `version.py` and imported them from `constants.py

57cbd55d
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

14 个文件 +123 -495
Modified README.md +20 -456
@@ -247,465 +247,29 @@ Run the Web UI on your smartphone for easy access on the go. Check out the dedic
247 247
248 248 ---
249 249
250 ## 🔗 Powered by gpt4free
250 ### 🚀 Used by gpt4free
251 251
252 <table>
253 <thead align="center">
254 <tr border: none;>
255 <td>
256 <b>🎁 Projects</b>
257 </td>
258 <td>
259 <b>⭐ Stars</b>
260 </td>
261 <td>
262 <b>📚 Forks</b>
263 </td>
264 <td>
265 <b>🛎 Issues</b>
266 </td>
267 <td>
268 <b>📬 Pull requests</b>
269 </td>
270 </tr>
271 </thead>
272 <tbody>
273 <tr>
274 <td>
275 <a href="https://github.com/xtekky/gpt4free">
276 <b>gpt4free</b>
277 </a>
278 </td>
279 <td>
280 <a href="https://github.com/xtekky/gpt4free/stargazers">
281 <img alt="Stars" src="https://img.shields.io/github/stars/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
282 </a>
283 </td>
284 <td>
285 <a href="https://github.com/xtekky/gpt4free/network/members">
286 <img alt="Forks" src="https://img.shields.io/github/forks/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
287 </a>
288 </td>
289 <td>
290 <a href="https://github.com/xtekky/gpt4free/issues">
291 <img alt="Issues" src="https://img.shields.io/github/issues/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
292 </a>
293 </td>
294 <td>
295 <a href="https://github.com/xtekky/gpt4free/pulls">
296 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xtekky/gpt4free?style=flat-square&labelColor=343b41" />
297 </a>
298 </td>
299 </tr>
300 <td>
301 <a href="https://github.com/xiangsx/gpt4free-ts">
302 <b>gpt4free-ts</b>
303 </a>
304 </td>
305 <td>
306 <a href="https://github.com/xiangsx/gpt4free-ts/stargazers">
307 <img alt="Stars" src="https://img.shields.io/github/stars/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
308 </a>
309 </td>
310 <td>
311 <a href="https://github.com/xiangsx/gpt4free-ts/network/members">
312 <img alt="Forks" src="https://img.shields.io/github/forks/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
313 </a>
314 </td>
315 <td>
316 <a href="https://github.com/xiangsx/gpt4free-ts/issues">
317 <img alt="Issues" src="https://img.shields.io/github/issues/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
318 </a>
319 </td>
320 <td>
321 <a href="https://github.com/xiangsx/gpt4free-ts/pulls">
322 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41" />
323 </a>
324 </td>
325 </tr>
326 <tr>
327 <td>
328 <a href="https://github.com/zukixa/cool-ai-stuff/">
329 <b>Free AI API's & Potential Providers List</b>
330 </a>
331 </td>
332 <td>
333 <a href="https://github.com/zukixa/cool-ai-stuff/stargazers">
334 <img alt="Stars" src="https://img.shields.io/github/stars/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
335 </a>
336 </td>
337 <td>
338 <a href="https://github.com/zukixa/cool-ai-stuff/network/members">
339 <img alt="Forks" src="https://img.shields.io/github/forks/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
340 </a>
341 </td>
342 <td>
343 <a href="https://github.com/zukixa/cool-ai-stuff/issues">
344 <img alt="Issues" src="https://img.shields.io/github/issues/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
345 </a>
346 </td>
347 <td>
348 <a href="https://github.com/zukixa/cool-ai-stuff/pulls">
349 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/zukixa/cool-ai-stuff?style=flat-square&labelColor=343b41" />
350 </a>
351 </td>
352 </tr>
353 <tr>
354 <tr>
355 <td>
356 <a href="https://github.com/xtekky/chatgpt-clone">
357 <b>ChatGPT-Clone</b>
358 </a>
359 </td>
360 <td>
361 <a href="https://github.com/xtekky/chatgpt-clone/stargazers">
362 <img alt="Stars" src="https://img.shields.io/github/stars/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
363 </a>
364 </td>
365 <td>
366 <a href="https://github.com/xtekky/chatgpt-clone/network/members">
367 <img alt="Forks" src="https://img.shields.io/github/forks/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
368 </a>
369 </td>
370 <td>
371 <a href="https://github.com/xtekky/chatgpt-clone/issues">
372 <img alt="Issues" src="https://img.shields.io/github/issues/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
373 </a>
374 </td>
375 <td>
376 <a href="https://github.com/xtekky/chatgpt-clone/pulls">
377 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41" />
378 </a>
379 </td>
380 </tr>
381 <tr>
382 <td>
383 <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free">
384 <b>Ai agent</b>
385 </a>
386 </td>
387 <td>
388 <a href="https://github.com/Josh-XT/AGiXT/stargazers">
389 <img alt="Stars" src="https://img.shields.io/github/stars/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
390 </a>
391 </td>
392 <td>
393 <a href="https://github.com/Josh-XT/AGiXT/network/members">
394 <img alt="Forks" src="https://img.shields.io/github/forks/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
395 </a>
396 </td>
397 <td>
398 <a href="https://github.com/Josh-XT/AGiXT/issues">
399 <img alt="Issues" src="https://img.shields.io/github/issues/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
400 </a>
401 </td>
402 <td>
403 <a href="https://github.com/Josh-XT/AGiXT/pulls">
404 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
405 </a>
406 </td>
407 </tr>
408 <tr>
409 <td>
410 <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free">
411 <b>ChatGpt Discord Bot</b>
412 </a>
413 </td>
414 <td>
415 <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/stargazers">
416 <img alt="Stars" src="https://img.shields.io/github/stars/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
417 </a>
418 </td>
419 <td>
420 <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/network/members">
421 <img alt="Forks" src="https://img.shields.io/github/forks/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
422 </a>
423 </td>
424 <td>
425 <a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/issues">
426 <img alt="Issues" src="https://img.shields.io/github/issues/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
427 </a>
428 </td>
429 <td>
430 <a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free/pulls">
431 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
432 </a>
433 </td>
434 <tr>
435 <tr>
436 <td>
437 <a href="https://github.com/Zero6992/chatGPT-discord-bot">
438 <b>chatGPT-discord-bot</b>
439 </a>
440 </td>
441 <td>
442 <a href="https://github.com/Zero6992/chatGPT-discord-bot/stargazers">
443 <img alt="Stars" src="https://img.shields.io/github/stars/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
444 </a>
445 </td>
446 <td>
447 <a href="https://github.com/Zero6992/chatGPT-discord-bot/network/members">
448 <img alt="Forks" src="https://img.shields.io/github/forks/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
449 </a>
450 </td>
451 <td>
452 <a href="https://github.com/Zero6992/chatGPT-discord-bot/issues">
453 <img alt="Issues" src="https://img.shields.io/github/issues/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
454 </a>
455 </td>
456 <td>
457 <a href="https://github.com/Zero6992/chatGPT-discord-bot/pulls">
458 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Zero6992/chatGPT-discord-bot?style=flat-square&labelColor=343b41" />
459 </a>
460 </td>
461 <tr>
462 <td>
463 <a href="https://github.com/SamirXR/Nyx-Bot">
464 <b>Nyx-Bot (Discord)</b>
465 </a>
466 </td>
467 <td>
468 <a href="https://github.com/SamirXR/Nyx-Bot/stargazers">
469 <img alt="Stars" src="https://img.shields.io/github/stars/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
470 </a>
471 </td>
472 <td>
473 <a href="https://github.com/SamirXR/Nyx-Bot/network/members">
474 <img alt="Forks" src="https://img.shields.io/github/forks/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
475 </a>
476 </td>
477 <td>
478 <a href="https://github.com/SamirXR/Nyx-Bot/issues">
479 <img alt="Issues" src="https://img.shields.io/github/issues/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
480 </a>
481 </td>
482 <td>
483 <a href="https://github.com/SamirXR/Nyx-Bot/pulls">
484 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/SamirXR/Nyx-Bot?style=flat-square&labelColor=343b41" />
485 </a>
486 </td>
487 </tr>
488 </tr>
489 <tr>
490 <td>
491 <a href="https://github.com/MIDORIBIN/langchain-gpt4free">
492 <b>LangChain gpt4free</b>
493 </a>
494 </td>
495 <td>
496 <a href="https://github.com/MIDORIBIN/langchain-gpt4free/stargazers">
497 <img alt="Stars" src="https://img.shields.io/github/stars/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
498 </a>
499 </td>
500 <td>
501 <a href="https://github.com/MIDORIBIN/langchain-gpt4free/network/members">
502 <img alt="Forks" src="https://img.shields.io/github/forks/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
503 </a>
504 </td>
505 <td>
506 <a href="https://github.com/MIDORIBIN/langchain-gpt4free/issues">
507 <img alt="Issues" src="https://img.shields.io/github/issues/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
508 </a>
509 </td>
510 <td>
511 <a href="https://github.com/MIDORIBIN/langchain-gpt4free/pulls">
512 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/MIDORIBIN/langchain-gpt4free?style=flat-square&labelColor=343b41" />
513 </a>
514 </td>
515 </tr>
516 <tr>
517 <td>
518 <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free">
519 <b>ChatGpt Telegram Bot</b>
520 </a>
521 </td>
522 <td>
523 <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/stargazers">
524 <img alt="Stars" src="https://img.shields.io/github/stars/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
525 </a>
526 </td>
527 <td>
528 <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/network/members">
529 <img alt="Forks" src="https://img.shields.io/github/forks/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
530 </a>
531 </td>
532 <td>
533 <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/issues">
534 <img alt="Issues" src="https://img.shields.io/github/issues/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
535 </a>
536 </td>
537 <td>
538 <a href="https://github.com/HexyeDEV/Telegram-Chatbot-Gpt4Free/pulls">
539 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/HexyeDEV/Telegram-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41" />
540 </a>
541 </td>
542 </tr>
543 <tr>
544 <td>
545 <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot">
546 <b>ChatGpt Line Bot</b>
547 </a>
548 </td>
549 <td>
550 <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/stargazers">
551 <img alt="Stars" src="https://img.shields.io/github/stars/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
552 </a>
553 </td>
554 <td>
555 <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/network/members">
556 <img alt="Forks" src="https://img.shields.io/github/forks/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
557 </a>
558 </td>
559 <td>
560 <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/issues">
561 <img alt="Issues" src="https://img.shields.io/github/issues/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
562 </a>
563 </td>
564 <td>
565 <a href="https://github.com/Lin-jun-xiang/chatgpt-line-bot/pulls">
566 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Lin-jun-xiang/chatgpt-line-bot?style=flat-square&labelColor=343b41" />
567 </a>
568 </td>
569 </tr>
570 <tr>
571 <td>
572 <a href="https://github.com/Lin-jun-xiang/action-translate-readme">
573 <b>Action Translate Readme</b>
574 </a>
575 </td>
576 <td>
577 <a href="https://github.com/Lin-jun-xiang/action-translate-readme/stargazers">
578 <img alt="Stars" src="https://img.shields.io/github/stars/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
579 </a>
580 </td>
581 <td>
582 <a href="https://github.com/Lin-jun-xiang/action-translate-readme/network/members">
583 <img alt="Forks" src="https://img.shields.io/github/forks/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
584 </a>
585 </td>
586 <td>
587 <a href="https://github.com/Lin-jun-xiang/action-translate-readme/issues">
588 <img alt="Issues" src="https://img.shields.io/github/issues/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
589 </a>
590 </td>
591 <td>
592 <a href="https://github.com/Lin-jun-xiang/action-translate-readme/pulls">
593 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Lin-jun-xiang/action-translate-readme?style=flat-square&labelColor=343b41" />
594 </a>
595 </td>
596 </tr>
597 <tr>
598 <td>
599 <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit">
600 <b>Langchain Document GPT</b>
601 </a>
602 </td>
603 <td>
604 <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/stargazers">
605 <img alt="Stars" src="https://img.shields.io/github/stars/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
606 </a>
607 </td>
608 <td>
609 <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/network/members">
610 <img alt="Forks" src="https://img.shields.io/github/forks/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
611 </a>
612 </td>
613 <td>
614 <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/issues">
615 <img alt="Issues" src="https://img.shields.io/github/issues/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
616 </a>
617 </td>
618 <td>
619 <a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/pulls">
620 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41" />
621 </a>
622 </td>
623 </tr>
624 <tr>
625 <td>
626 <a href="https://github.com/Simatwa/python-tgpt">
627 <b>python-tgpt</b>
628 </a>
629 </td>
630 <td>
631 <a href="https://github.com/Simatwa/python-tgpt/stargazers">
632 <img alt="Stars" src="https://img.shields.io/github/stars/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
633 </a>
634 </td>
635 <td>
636 <a href="https://github.com/Simatwa/python-tgpt/network/members">
637 <img alt="Forks" src="https://img.shields.io/github/forks/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
638 </a>
639 </td>
640 <td>
641 <a href="https://github.com/Simatwa/python-tgpt/issues">
642 <img alt="Issues" src="https://img.shields.io/github/issues/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
643 </a>
644 </td>
645 <td>
646 <a href="https://github.com/Simatwa/python-tgpt/pulls">
647 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Simatwa/python-tgpt?style=flat-square&labelColor=343b41" />
648 </a>
649 </td>
650 </tr>
651 <tr>
652 <td>
653 <a href="https://github.com/zachey01/gpt4free.js">
654 <b>GPT4js</b>
655 </a>
656 </td>
657 <td>
658 <a href="https://github.com/zachey01/gpt4free.js/stargazers">
659 <img alt="Stars" src="https://img.shields.io/github/stars/zachey01/gpt4free.js?style=flat-square&labelColor=343b41" />
660 </a>
661 </td>
662 <td>
663 <a href="https://github.com/zachey01/gpt4free.js/network/members">
664 <img alt="Forks" src="https://img.shields.io/github/forks/zachey01/gpt4free.js?style=flat-square&labelColor=343b41" />
665 </a>
666 </td>
667 <td>
668 <a href="https://github.com/zachey01/gpt4free.js/issues">
669 <img alt="Issues" src="https://img.shields.io/github/issues/zachey01/gpt4free.js?style=flat-square&labelColor=343b41" />
670 </a>
671 </td>
672 <td>
673 <a href="https://github.com/zachey01/gpt4free.js/pulls">
674 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/zachey01/gpt4free.js?style=flat-square&labelColor=343b41" />
675 </a>
676 </td>
677 </tr>
678 <tr>
679 <td>
680 <a href="https://github.com/yjg30737/pyqt-openai">
681 <b>VividNode (pyqt-openai)</b>
682 </a>
683 </td>
684 <td>
685 <a href="https://github.com/yjg30737/pyqt-openai/stargazers">
686 <img alt="Stars" src="https://img.shields.io/github/stars/yjg30737/pyqt-openai?style=flat-square&labelColor=343b41" />
687 </a>
688 </td>
689 <td>
690 <a href="https://github.com/yjg30737/pyqt-openai/network/members">
691 <img alt="Forks" src="https://img.shields.io/github/forks/yjg30737/pyqt-openai?style=flat-square&labelColor=343b41" />
692 </a>
693 </td>
694 <td>
695 <a href="https://github.com/yjg30737/pyqt-openai/issues">
696 <img alt="Issues" src="https://img.shields.io/github/issues/yjg30737/pyqt-openai?style=flat-square&labelColor=343b41" />
697 </a>
698 </td>
699 <td>
700 <a href="https://github.com/yjg30737/pyqt-openai/pulls">
701 <img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/yjg30737/pyqt-openai?style=flat-square&labelColor=343b41" />
702 </a>
703 </td>
704 </tr>
705 </tbody>
706 </table>
252 **🌟 Pollinations AI**
253
254 <img src="https://image.pollinations.ai/prompt/Create+a+logo+for+Pollinations+AI+featuring+an+abstract+flower+blooming+digital+petals+glowing+center+futuristic+font+Pollinations+AI?width=512&height=256&nologo=true" height="128">
255
256 A creative AI content platform that generates images, audios, and other media using advanced generative models. Pollinations AI empowers users and developers to turn text into visuals and multimedia experiences.
257
258 > [github.com/pollinations/pollinations](https://github.com/pollinations/pollinations)
259
260 ---
261
262 ### 💸 Powered by GPT4Free
263
264 **🖨️ MoneyPrinter**
265
266 <img src="https://image.pollinations.ai/prompt/Create+a+logo+for+MoneyPrinter+glowing+center+futuristic+font?width=512&height=256&nologo=true" height="128">
267
268 MoneyPrinter V2 cranks up the automation for making money online. It’s a complete overhaul of the original MoneyPrinter, rebuilt from the ground up for more features and a plug-and-play, modular design. MPV2 takes the grind and guesswork out of online income: just set it up, let it run, and watch your earnings stack.
707 269
270 > [FujiwaraChoki/MoneyPrinterV2 on GitHub](https://github.com/FujiwaraChoki/MoneyPrinterV2)
708 271
272 > [Full list of GPT4Free powered sites and tools](https://github.com/gpt4free/gpt4free.github.io/blob/main/docs/powered-by.md)
709 273
710 274 ## 🤝 Contribute
711 275 We welcome contributions from the community. Whether you're adding new providers or features, or simply fixing typos and making small improvements, your input is valued. Creating a pull request is all it takes – our co-pilot will handle the code review process. Once all changes have been addressed, we'll merge the pull request into the main branch and release the updates at a later time.
Modified g4f/Provider/Cloudflare.py +1 -3
@@ -98,8 +98,6 @@ class Cloudflare(AsyncGeneratorProvider, ProviderModelMixin, AuthFileMixin):
98 98 messages: Messages,
99 99 proxy: str = None,
100 100 max_tokens: int = 2048,
101 cookies: Cookies = None,
102 timeout: int = 300,
103 101 **kwargs
104 102 ) -> AsyncResult:
105 103 cache_file = cls.get_cache_file()
@@ -109,7 +107,7 @@ class Cloudflare(AsyncGeneratorProvider, ProviderModelMixin, AuthFileMixin):
109 107 cls._args = json.load(f)
110 108 elif has_nodriver:
111 109 try:
112 cls._args = await get_args_from_nodriver(cls.url)
110 cls._args = await get_args_from_nodriver(cls.url, proxy=proxy)
113 111 except (RuntimeError, FileNotFoundError) as e:
114 112 debug.log(f"Nodriver is not available: {type(e).__name__}: {e}")
115 113 cls._args = {"headers": DEFAULT_HEADERS, "cookies": {}, "impersonate": "chrome"}
Modified g4f/Provider/PollinationsAI.py +56 -2
@@ -18,8 +18,9 @@ from ..requests.raise_for_status import raise_for_status
18 18 from ..requests.aiohttp import get_connector
19 19 from ..image.copy_images import save_response_media
20 20 from ..image import use_aspect_ratio
21 from ..providers.response import FinishReason, Usage, ToolCalls, ImageResponse, Reasoning
21 from ..providers.response import FinishReason, Usage, ToolCalls, ImageResponse, Reasoning, TitleGeneration, SuggestedFollowups
22 22 from ..tools.media import render_messages
23 from ..constants import STATIC_URL
23 24 from .. import debug
24 25
25 26 DEFAULT_HEADERS = {
@@ -30,6 +31,36 @@ DEFAULT_HEADERS = {
30 31 "origin": "https://pollinations.ai",
31 32 }
32 33
34 FOLLOWUPS_TOOLS = [{
35 "type": "function",
36 "function": {
37 "name": "options",
38 "description": "Provides options for the conversation",
39 "parameters": {
40 "properties": {
41 "title": {
42 "title": "Conversation Title",
43 "type": "string"
44 },
45 "followups": {
46 "items": {
47 "type": "string"
48 },
49 "title": "Suggested Followups",
50 "type": "array"
51 }
52 },
53 "title": "Conversation",
54 "type": "object"
55 }
56 }
57 }]
58
59 FOLLOWUPS_DEVELOPER_MESSAGE = [{
60 "role": "developer",
61 "content": "Prefix conversation title with one or more emojies. Suggested 4 Followups"
62 }]
63
33 64 class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
34 65 label = "Pollinations AI"
35 66 url = "https://pollinations.ai"
@@ -201,7 +232,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
201 232 stream: bool = True,
202 233 proxy: str = None,
203 234 cache: bool = False,
204 referrer: str = "https://gpt4free.github.io/",
235 referrer: str = STATIC_URL,
205 236 extra_body: dict = {},
206 237 # Image generation parameters
207 238 prompt: str = None,
@@ -400,6 +431,9 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
400 431 content = choice.get("delta", {}).get("content")
401 432 if content:
402 433 yield content
434 tool_calls = choice.get("delta", {}).get("tool_calls")
435 if tool_calls:
436 yield ToolCalls(choice["delta"]["tool_calls"])
403 437 reasoning_content = choice.get("delta", {}).get("reasoning_content")
404 438 if reasoning_content:
405 439 reasoning = True
@@ -409,6 +443,26 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
409 443 yield FinishReason(finish_reason)
410 444 if reasoning:
411 445 yield Reasoning(status="Done")
446 if "action" in kwargs and "tools" not in data and "response_format" not in data:
447 data = {
448 "model": model,
449 "messages": messages + FOLLOWUPS_DEVELOPER_MESSAGE,
450 "tool_choice": "required",
451 "tools": FOLLOWUPS_TOOLS
452 }
453 async with session.post(url, json=data, headers={"referer": referrer}) as response:
454 try:
455 await raise_for_status(response)
456 tool_calls = (await response.json()).get("choices", [{}])[0].get("message", {}).get("tool_calls", [])
457 if tool_calls:
458 arguments = json.loads(tool_calls.pop().get("function", {}).get("arguments"))
459 if arguments.get("title"):
460 yield TitleGeneration(arguments.get("title"))
461 if arguments.get("followups"):
462 yield SuggestedFollowups(arguments.get("followups"))
463 except Exception as e:
464 debug.error("Error generating title and followups")
465 debug.error(e)
412 466 elif response.headers["content-type"].startswith("application/json"):
413 467 result = await response.json()
414 468 if "choices" in result:
Modified g4f/Provider/PollinationsImage.py +2 -1
@@ -4,6 +4,7 @@ from typing import Optional
4 4
5 5 from .helper import format_image_prompt
6 6 from ..typing import AsyncResult, Messages
7 from ..constants import STATIC_URL
7 8 from .PollinationsAI import PollinationsAI
8 9
9 10 class PollinationsImage(PollinationsAI):
@@ -37,7 +38,7 @@ class PollinationsImage(PollinationsAI):
37 38 model: str,
38 39 messages: Messages,
39 40 proxy: str = None,
40 referrer: str = "https://gpt4free.github.io/",
41 referrer: str = STATIC_URL,
41 42 prompt: str = None,
42 43 aspect_ratio: str = "1:1",
43 44 width: int = None,
Modified g4f/Provider/har/__init__.py +2 -2
@@ -6,7 +6,7 @@ import uuid
6 6 from urllib.parse import urlparse
7 7
8 8 from ...typing import AsyncResult, Messages, MediaListType
9 from ...requests import StreamSession, StreamResponse, FormData, raise_for_status
9 from ...requests import DEFAULT_HEADERS, StreamSession, StreamResponse, FormData, raise_for_status
10 10 from ...providers.response import JsonConversation
11 11 from ...tools.media import merge_media
12 12 from ...image import to_bytes, is_accepted_format
@@ -192,7 +192,7 @@ class HarProvider(AsyncGeneratorProvider, ProviderModelMixin):
192 192 postData = postData.replace("__MODEL__", model)
193 193 request_url = request_url.replace("__SESSION__", conversation.session_hash)
194 194 method = v['request']['method'].lower()
195 async with getattr(session, method)(request_url, data=postData, headers=get_headers(v), proxy=proxy) as response:
195 async with getattr(session, method)(request_url, data=postData, headers={**get_headers(v), **DEFAULT_HEADERS}, proxy=proxy) as response:
196 196 await raise_for_status(response)
197 197 async for chunk in read_response(response):
198 198 yield chunk
Modified g4f/Provider/needs_auth/OpenaiChat.py +2 -2
@@ -680,9 +680,9 @@ class OpenaiChat(AsyncAuthedProvider, ProviderModelMixin):
680 680 page.add_handler(nodriver.cdp.network.RequestWillBeSent, on_request)
681 681 page = await browser.get(cls.url)
682 682 user_agent = await page.evaluate("window.navigator.userAgent", return_by_value=True)
683 while not await page.evaluate("document.getElementById('prompt-textarea').id"):
683 while not await page.evaluate("document.getElementById('prompt-textarea')?.id"):
684 684 await asyncio.sleep(1)
685 while not await page.evaluate("document.querySelector('[data-testid=\"send-button\"]').type"):
685 while not await page.evaluate("document.querySelector('[data-testid=\"send-button\"]')?.type"):
686 686 await asyncio.sleep(1)
687 687 await page.evaluate("document.querySelector('[data-testid=\"send-button\"]').click()")
688 688 while True:
Modified g4f/client/__init__.py +11 -9
@@ -41,7 +41,7 @@ except NameError:
41 41 def add_chunk(content, chunk):
42 42 if content == "" and isinstance(chunk, (MediaResponse, AudioResponse)):
43 43 content = chunk
44 elif not isinstance(chunk, Reasoning):
44 elif not isinstance(chunk, (Reasoning, ToolCalls)):
45 45 content = str(content) + str(chunk)
46 46 return content
47 47
@@ -85,8 +85,9 @@ def iter_response(
85 85 conversation = chunk
86 86 continue
87 87 elif isinstance(chunk, ToolCalls):
88 tool_calls = chunk.get_list()
89 continue
88 if not stream:
89 tool_calls = chunk.get_list()
90 continue
90 91 elif isinstance(chunk, Usage):
91 92 usage = chunk
92 93 continue
@@ -99,10 +100,10 @@ def iter_response(
99 100 continue
100 101 elif isinstance(chunk, Exception):
101 102 continue
103 elif not chunk:
104 continue
102 105
103 106 content = add_chunk(content, chunk)
104 if not content:
105 continue
106 107 idx += 1
107 108
108 109 if max_tokens is not None and idx >= max_tokens:
@@ -187,8 +188,9 @@ async def async_iter_response(
187 188 conversation = chunk
188 189 continue
189 190 elif isinstance(chunk, ToolCalls):
190 tool_calls = chunk.get_list()
191 continue
191 if not stream:
192 tool_calls = chunk.get_list()
193 continue
192 194 elif isinstance(chunk, Usage):
193 195 usage = chunk
194 196 continue
@@ -201,10 +203,10 @@ async def async_iter_response(
201 203 continue
202 204 elif isinstance(chunk, Exception):
203 205 continue
206 elif not chunk:
207 continue
204 208
205 209 content = add_chunk(content, chunk)
206 if not content:
207 continue
208 210 idx += 1
209 211
210 212 if max_tokens is not None and idx >= max_tokens:
Modified g4f/client/stubs.py +7 -2
@@ -7,7 +7,7 @@ from time import time
7 7 from ..image import extract_data_uri
8 8 from ..image.copy_images import get_media_dir
9 9 from ..client.helper import filter_markdown
10 from ..providers.response import Reasoning
10 from ..providers.response import Reasoning, ToolCalls
11 11 from .helper import filter_none
12 12
13 13 try:
@@ -253,18 +253,23 @@ class ChatCompletionDelta(BaseModel):
253 253 role: str
254 254 content: Optional[str]
255 255 reasoning_content: Optional[str] = None
256 tool_calls: list[ToolCallModel] = None
256 257
257 258 @classmethod
258 259 def model_construct(cls, content: Optional[str]):
259 260 if isinstance(content, Reasoning):
260 261 return super().model_construct(role="reasoning", content=content, reasoning_content=str(content))
262 elif isinstance(content, ToolCalls):
263 return super().model_construct(role="assistant", content=None, tool_calls=[
264 ToolCallModel.model_construct(**tool_call) for tool_call in content.get_list()
265 ])
261 266 return super().model_construct(role="assistant", content=content)
262 267
263 268 @field_serializer('content')
264 269 def serialize_content(self, content: Optional[str]):
265 270 if content is None:
266 271 return ""
267 if isinstance(content, Reasoning):
272 if isinstance(content, (Reasoning, ToolCalls)):
268 273 return None
269 274 return str(content)
270 275
Added g4f/constants.py +5 -0
@@ -0,0 +1,5 @@
1 PACKAGE_NAME = "g4f"
2 GITHUB_REPOSITORY = "xtekky/gpt4free"
3 STATIC_DOMAIN = "gpt4free.github.io"
4 STATIC_URL = f"https://{STATIC_DOMAIN}/"
5 DIST_DIR = f"./{STATIC_DOMAIN}/dist"
Modified g4f/gui/server/website.py +8 -9
@@ -7,17 +7,16 @@ from flask import send_from_directory, redirect
7 7 from ...image.copy_images import secure_filename
8 8 from ...cookies import get_cookies_dir
9 9 from ...errors import VersionNotFoundError
10 from ...constants import STATIC_URL, DIST_DIR
10 11 from ... import version
11 12
12 GPT4FREE_URL = "https://gpt4free.github.io"
13 DIST_DIR = "./gpt4free.github.io/dist"
14
15 13 def redirect_home():
16 14 return redirect('/chat')
17 15
18 def render(filename = "chat", add_origion = True):
16 def render(filename = "chat"):
17 is_live = True
19 18 if os.path.exists(DIST_DIR):
20 add_origion = False
19 is_live = False
21 20 path = os.path.abspath(os.path.join(os.path.dirname(DIST_DIR), (filename + ("" if "." in filename else ".html"))))
22 21 return send_from_directory(os.path.dirname(path), os.path.basename(path))
23 22 try:
@@ -26,13 +25,13 @@ def render(filename = "chat", add_origion = True):
26 25 latest_version = version.utils.current_version
27 26 today = datetime.today().strftime('%Y-%m-%d')
28 27 cache_dir = os.path.join(get_cookies_dir(), ".gui_cache")
29 cache_file = os.path.join(cache_dir, f"{today}.{secure_filename(filename)}.{version.utils.current_version}-{latest_version}{'.live' if add_origion else ''}.html")
28 cache_file = os.path.join(cache_dir, f"{today}.{secure_filename(f'{filename}.{version.utils.current_version}-{latest_version}')}{'.live' if is_live else ''}.html")
30 29 if not os.path.exists(cache_file):
31 30 os.makedirs(cache_dir, exist_ok=True)
32 html = requests.get(f"{GPT4FREE_URL}/{filename}.html").text
33 if add_origion:
31 html = requests.get(f"{STATIC_URL}{filename}.html").text
32 if is_live:
34 33 html = html.replace("../dist/", f"dist/")
35 html = html.replace("\"dist/", f"\"{GPT4FREE_URL}/dist/")
34 html = html.replace("\"dist/", f"\"{STATIC_URL}dist/")
36 35 with open(cache_file, 'w', encoding='utf-8') as f:
37 36 f.write(html)
38 37 return send_from_directory(os.path.abspath(cache_dir), os.path.basename(cache_file))
Modified g4f/providers/any_provider.py +3 -1
@@ -221,7 +221,9 @@ class AnyProvider(AsyncGeneratorProvider, ProviderModelMixin):
221 221 has_audio = True
222 222 break
223 223 has_image = True
224 if "audio" in kwargs or "audio" in kwargs.get("modalities", []):
224 if "tools" in kwargs:
225 providers = [PollinationsAI]
226 elif "audio" in kwargs or "audio" in kwargs.get("modalities", []):
225 227 providers = [PollinationsAI, EdgeTTS, gTTS]
226 228 elif has_audio:
227 229 providers = [PollinationsAI, Microsoft_Phi_4_Multimodal, MarkItDown]
Modified g4f/providers/response.py +3 -0
@@ -6,6 +6,9 @@ from typing import Union, Dict, List, Optional
6 6 from abc import abstractmethod
7 7 from urllib.parse import quote_plus, unquote_plus
8 8
9 def is_content(chunk):
10 return isinstance(chunk, (str, MediaResponse, AudioResponse, Reasoning, ToolCalls))
11
9 12 def quote_url(url: str) -> str:
10 13 """
11 14 Quote parts of a URL while preserving the domain structure.
Modified g4f/providers/retry_provider.py +2 -5
Modified g4f/version.py +1 -3