diff options
author | t.me/xtekky <98614666+xtekky@users.noreply.github.com> | 2023-06-24 03:47:00 +0200 |
---|---|---|
committer | t.me/xtekky <98614666+xtekky@users.noreply.github.com> | 2023-06-24 03:47:00 +0200 |
commit | 5db58fd87f230fbe5bae599bb4b120ab42cad3be (patch) | |
tree | 770be13bca77c5d04dfe3265f378431df788706f /g4f/.v1/gui | |
parent | Merge pull request #664 from LopeKinz/main (diff) | |
download | gpt4free-5db58fd87f230fbe5bae599bb4b120ab42cad3be.tar gpt4free-5db58fd87f230fbe5bae599bb4b120ab42cad3be.tar.gz gpt4free-5db58fd87f230fbe5bae599bb4b120ab42cad3be.tar.bz2 gpt4free-5db58fd87f230fbe5bae599bb4b120ab42cad3be.tar.lz gpt4free-5db58fd87f230fbe5bae599bb4b120ab42cad3be.tar.xz gpt4free-5db58fd87f230fbe5bae599bb4b120ab42cad3be.tar.zst gpt4free-5db58fd87f230fbe5bae599bb4b120ab42cad3be.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/.v1/gui/README.md (renamed from gui/README.md) | 0 | ||||
-rw-r--r-- | g4f/.v1/gui/__init__.py (renamed from gui/__init__.py) | 0 | ||||
-rw-r--r-- | g4f/.v1/gui/image1.png (renamed from gui/image1.png) | bin | 172284 -> 172284 bytes | |||
-rw-r--r-- | g4f/.v1/gui/image2.png (renamed from gui/image2.png) | bin | 343564 -> 343564 bytes | |||
-rw-r--r-- | g4f/.v1/gui/pywebio-gui/README.md (renamed from gui/pywebio-gui/README.md) | 0 | ||||
-rw-r--r-- | g4f/.v1/gui/pywebio-gui/pywebio-usesless.py (renamed from gui/pywebio-gui/pywebio-usesless.py) | 118 | ||||
-rw-r--r-- | g4f/.v1/gui/query_methods.py (renamed from gui/query_methods.py) | 0 | ||||
-rw-r--r-- | g4f/.v1/gui/streamlit_app.py (renamed from gui/streamlit_app.py) | 0 | ||||
-rw-r--r-- | g4f/.v1/gui/streamlit_chat_app.py (renamed from gui/streamlit_chat_app.py) | 0 |
9 files changed, 59 insertions, 59 deletions
diff --git a/gui/README.md b/g4f/.v1/gui/README.md index c0406216..c0406216 100644 --- a/gui/README.md +++ b/g4f/.v1/gui/README.md diff --git a/gui/__init__.py b/g4f/.v1/gui/__init__.py index e69de29b..e69de29b 100644 --- a/gui/__init__.py +++ b/g4f/.v1/gui/__init__.py diff --git a/gui/image1.png b/g4f/.v1/gui/image1.png Binary files differindex fb84ae7f..fb84ae7f 100644 --- a/gui/image1.png +++ b/g4f/.v1/gui/image1.png diff --git a/gui/image2.png b/g4f/.v1/gui/image2.png Binary files differindex c5fc91c9..c5fc91c9 100644 --- a/gui/image2.png +++ b/g4f/.v1/gui/image2.png diff --git a/gui/pywebio-gui/README.md b/g4f/.v1/gui/pywebio-gui/README.md index 2b99c075..2b99c075 100644 --- a/gui/pywebio-gui/README.md +++ b/g4f/.v1/gui/pywebio-gui/README.md diff --git a/gui/pywebio-gui/pywebio-usesless.py b/g4f/.v1/gui/pywebio-gui/pywebio-usesless.py index c0843be6..177fa7c8 100644 --- a/gui/pywebio-gui/pywebio-usesless.py +++ b/g4f/.v1/gui/pywebio-gui/pywebio-usesless.py @@ -1,59 +1,59 @@ -from gpt4free import usesless
-import time
-from pywebio import start_server,config
-from pywebio.input import *
-from pywebio.output import *
-from pywebio.session import local
-message_id = ""
-def status():
- try:
- req = usesless.Completion.create(prompt="hello", parentMessageId=message_id)
- print(f"Answer: {req['text']}")
- put_success(f"Answer: {req['text']}",scope="body")
- except:
- put_error("Program Error",scope="body")
-
-def ask(prompt):
- req = usesless.Completion.create(prompt=prompt, parentMessageId=local.message_id)
- rp=req['text']
- local.message_id=req["id"]
- print("AI:\n"+rp)
- local.conversation.extend([
- {"role": "user", "content": prompt},
- {"role": "assistant", "content": rp}
- ])
- print(local.conversation)
- return rp
-
-def msg():
- while True:
- text= input_group("You:",[textarea('You:',name='text',rows=3, placeholder='请输入问题')])
- if not(bool(text)):
- break
- if not(bool(text["text"])):
- continue
- time.sleep(0.5)
- put_code("You:"+text["text"],scope="body")
- print("Question:"+text["text"])
- with use_scope('foot'):
- put_loading(color="info")
- rp= ask(text["text"])
- clear(scope="foot")
- time.sleep(0.5)
- put_markdown("Bot:\n"+rp,scope="body")
- time.sleep(0.7)
-
-@config(title="AIchat",theme="dark")
-def main():
- put_scope("heads")
- with use_scope('heads'):
- put_html("<h1><center>AI Chat</center></h1>")
- put_scope("body")
- put_scope("foot")
- status()
- local.conversation=[]
- local.message_id=""
- msg()
-
-print("Click link to chat page")
-start_server(main, port=8099,allowed_origins="*",auto_open_webbrowser=True,debug=True)
+from gpt4free import usesless +import time +from pywebio import start_server,config +from pywebio.input import * +from pywebio.output import * +from pywebio.session import local +message_id = "" +def status(): + try: + req = usesless.Completion.create(prompt="hello", parentMessageId=message_id) + print(f"Answer: {req['text']}") + put_success(f"Answer: {req['text']}",scope="body") + except: + put_error("Program Error",scope="body") + +def ask(prompt): + req = usesless.Completion.create(prompt=prompt, parentMessageId=local.message_id) + rp=req['text'] + local.message_id=req["id"] + print("AI:\n"+rp) + local.conversation.extend([ + {"role": "user", "content": prompt}, + {"role": "assistant", "content": rp} + ]) + print(local.conversation) + return rp + +def msg(): + while True: + text= input_group("You:",[textarea('You:',name='text',rows=3, placeholder='请输入问题')]) + if not(bool(text)): + break + if not(bool(text["text"])): + continue + time.sleep(0.5) + put_code("You:"+text["text"],scope="body") + print("Question:"+text["text"]) + with use_scope('foot'): + put_loading(color="info") + rp= ask(text["text"]) + clear(scope="foot") + time.sleep(0.5) + put_markdown("Bot:\n"+rp,scope="body") + time.sleep(0.7) + +@config(title="AIchat",theme="dark") +def main(): + put_scope("heads") + with use_scope('heads'): + put_html("<h1><center>AI Chat</center></h1>") + put_scope("body") + put_scope("foot") + status() + local.conversation=[] + local.message_id="" + msg() + +print("Click link to chat page") +start_server(main, port=8099,allowed_origins="*",auto_open_webbrowser=True,debug=True) diff --git a/gui/query_methods.py b/g4f/.v1/gui/query_methods.py index 2d6adacd..2d6adacd 100644 --- a/gui/query_methods.py +++ b/g4f/.v1/gui/query_methods.py diff --git a/gui/streamlit_app.py b/g4f/.v1/gui/streamlit_app.py index 2dba0a7b..2dba0a7b 100644 --- a/gui/streamlit_app.py +++ b/g4f/.v1/gui/streamlit_app.py diff --git a/gui/streamlit_chat_app.py b/g4f/.v1/gui/streamlit_chat_app.py index af3969e6..af3969e6 100644 --- a/gui/streamlit_chat_app.py +++ b/g4f/.v1/gui/streamlit_chat_app.py |