summaryrefslogtreecommitdiffstats
path: root/g4f/.v1/gui/pywebio-gui
diff options
context:
space:
mode:
authorMIDORIBIN <aquarion123@gmail.com>2023-07-28 12:07:17 +0200
committerMIDORIBIN <aquarion123@gmail.com>2023-08-14 04:46:32 +0200
commitf6ef3cb2237d8c336e915ef77ddbe6f37934c4fd (patch)
treec8bc44917ea03909cf586140f984ff0814bc30ea /g4f/.v1/gui/pywebio-gui
parent~ | small fixes & new pypi version | v-0.0.1.9 (diff)
downloadgpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.gz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.bz2
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.lz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.xz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.zst
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.zip
Diffstat (limited to 'g4f/.v1/gui/pywebio-gui')
-rw-r--r--g4f/.v1/gui/pywebio-gui/README.md24
-rw-r--r--g4f/.v1/gui/pywebio-gui/pywebio-usesless.py59
2 files changed, 0 insertions, 83 deletions
diff --git a/g4f/.v1/gui/pywebio-gui/README.md b/g4f/.v1/gui/pywebio-gui/README.md
deleted file mode 100644
index 2b99c075..00000000
--- a/g4f/.v1/gui/pywebio-gui/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# GUI with PyWebIO
-Simple, fast, and with fewer errors
-Only requires
-```bash
-pip install gpt4free
-pip install pywebio
-```
-clicking on 'pywebio-usesless.py' will run it
-
-PS: Currently, only 'usesless' is implemented, and the GUI is expected to be updated infrequently, with a focus on stability.
-
-↓ Here is the introduction in zh-Hans-CN below.
-
-# 使用pywebio实现的极简GUI
-简单,快捷,报错少
-只需要
-```bash
-pip install gpt4free
-pip install pywebio
-```
-
-双击pywebio-usesless.py即可运行
-
-ps:目前仅实现usesless,这个gui更新频率应该会比较少,目的是追求稳定
diff --git a/g4f/.v1/gui/pywebio-gui/pywebio-usesless.py b/g4f/.v1/gui/pywebio-gui/pywebio-usesless.py
deleted file mode 100644
index 177fa7c8..00000000
--- a/g4f/.v1/gui/pywebio-gui/pywebio-usesless.py
+++ /dev/null
@@ -1,59 +0,0 @@
-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)