Code Monkey home page Code Monkey logo

pyqt-openai's Introduction

VividNode(pyqt-openai)

PyPI - Version Downloads PyPI - Python Version

녹화_2024_08_31_21_42_47_27


What is VividNode? 🤔

VividNode is a cross-platform desktop application that allows you to interact directly with GPT chatbots (like ChatGPT) and generate images without needing a browser. Built with PySide6, VividNode (formerly known as pyqt-openai) supports Windows, Mac, and Linux, and securely stores your chat history locally in a database.

Key Features:

  • Chat Interface: Enjoy a seamless chat experience with a customizable interface, fast thread and message search, and advanced conversation settings. You can also import/export chat histories and use prompt management tools for efficient prompt engineering.
  • Image Generation: Generate images using OpenAI’s DALL-E 3 or models from Replicate, directly within your chat sessions. The app supports multi-image generation, automatic saving, and integrated image management.
  • Focus and Accessibility Modes: Utilize Focus Mode, “Always on Top” Mode, transparency adjustments, and background notifications to keep the chat accessible and responsive without overwhelming system resources.
  • Customization and Shortcuts: VividNode offers extensive customization options, including language settings, memory management, and a comprehensive list of keyboard shortcuts for faster operations.

With VividNode, you can experience a more powerful and resource-efficient alternative to browser-based GPT interfaces, making it easier to manage both text and image-based interactions.


Sidenote 🗒️

Although this is named 'pyqt-openai', the model does not use only OpenAI-related models, and the GUI is created using PySide6, not PyQt. 'pyqt-openai' was the package name decided initially, and we are still using it as changing the package name now would likely result in a huge disaster.

How to Install

Install with traditional way

  1. git clone ~
  2. cd pyqt-openai
  3. pip install -r requirements.txt --upgrade
  4. cd pyqt_openai
  5. You should put your api key in the line edit. You can get it in official site of openai. Sign up and log in before you get it.
  6. python main.py

Install with pyproject.toml

  1. git clone ~
  2. Run shell as Administrator
  3. cd pyqt-openai
  4. pip install .
  5. pyqt-openai

Wanna download this without doing stuffs like above? You can download zip file here

How to Use 🧐

QuickStart

Support 🫡

Join our Discord Channel for questions or discussions!

Also we need contributor, You can contact me 24/7 by sending me an email to [email protected].

Donate

Buy Me a Coffee at ko-fi.com
Donate with PayPal

Disclaimer

Please do not distribute this commercially without my permission, by claiming it as your own creation.

pyqt-openai's People

Contributors

yjg30737 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyqt-openai's Issues

SVG images missing

I believe the icon folder is lacking the delete_light.svg and the add_light.svg

Seems a problem with QGuiApplication

AFter checking all module installation I found the following problem while running python main.py

main.py", line 21, in
QGuiApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.Round)
AttributeError: type object 'QGuiApplication' has no attribute 'setHighDpiScaleFactorRoundingPolicy'

ModuleNotFoundError: No module named 'pyqt_openai'

Hi Gyu Yoon,

hope you are doing well!

I'd like to draw you attention to still open an old issue.
You cannot run your code without going through setup process, just as mentioned here.

I believe you went through setup process (python setup.py install) at least once and the modules are on the path. If you try to follow the steps from above link in a fresh environment you will get this:

peter@alfa:~/Development/AI-and-chatGPT/pyqt-openai$ ll
total 44
drwxrwxr-x  5 peter peter 4096 Mai 28 19:24 ./
drwxrwxr-x 15 peter peter 4096 Mai 28 19:24 ../
drwxrwxr-x  8 peter peter 4096 Mai 28 19:24 .git/
-rw-rw-r--  1 peter peter 1860 Mai 28 19:24 .gitignore
drwxrwxr-x  3 peter peter 4096 Mai 28 19:24 .idea/
-rw-rw-r--  1 peter peter 1070 Mai 28 19:24 LICENSE
drwxrwxr-x  8 peter peter 4096 Mai 28 19:24 pyqt_openai/
-rw-rw-r--  1 peter peter 5946 Mai 28 19:24 README.md
-rw-rw-r--  1 peter peter   66 Mai 28 19:24 requirements.txt
-rw-rw-r--  1 peter peter 1165 Mai 28 19:24 setup.py
peter@alfa:~/Development/AI-and-chatGPT/pyqt-openai$ cd pyqt_openai/
peter@alfa:~/Development/AI-and-chatGPT/pyqt-openai/pyqt_openai$ python3 main.py 
Traceback (most recent call last):
  File "/home/peter/Development/AI-and-chatGPT/pyqt-openai/pyqt_openai/main.py", line 10, in <module>
    from pyqt_openai.aboutDialog import AboutDialog
ModuleNotFoundError: No module named 'pyqt_openai'
peter@alfa:~/Development/AI-and-chatGPT/pyqt-openai/pyqt_openai$ 

sqlite3.OperationalError: duplicate column name: engine

Hi Gyu Yoon,

Nice job, thank you for sharing!

I like your idea of replicating the playground and extending this with some additional features.
A few observation from my side:
Not installing your application and simply calling python3 main.py I'm getting following problem:
peter@alfa:~/Development/AI-and-chatGPT/pyqt-openai/pyqt_openai$ python3 main.py Traceback (most recent call last): File "/home/peter/Development/AI-and-chatGPT/pyqt-openai/pyqt_openai/main.py", line 16, in <module> from pyqt_openai.apiData import getModelEndpoint
Solution: move main.py one folder higher to the root of the repo.
and modify line 6 and 7:

from pyqt_openai.chatWidget import Prompt, ChatBrowser

from pyqt_openai.notifier import NotifierWidget

When I start the main.py module for the very first time I'm getting following error:

sqlite3.OperationalError: duplicate column name: engine

You have a typo in the file pyqt_openai/sqlite.py

engine TEXT DEFAULT '{self.__chat_default_value['system']}',

It should be:

system TEXT DEFAULT '{self.__chat_default_value['system']}',

The code does not work with GPT-4.
in the main.py line 433:
if info_dict['engine'] in ['gpt-3.5-turbo', 'gpt-3.5-turbo-0301']:
gpt-4 engine version is missing. quick fix:
if info_dict['engine'] in ['gpt-3.5-turbo', 'gpt-3.5-turbo-0301', 'gpt-4']:

As I'm going to change few additional things, do you mind if I fork your code? I will keep your name and licence model.

Sorry I did not prepare PR, just wanted to inform you :)

Regards
Peter

is it possible to autocomplete text using openai in pyqt?

Hi,

I'm looking for options to implement an autocompletion plugin in an application that uses PyQT. The completion would be using openai's codex (and ultimately be extended to other models).

It would really help me if I saw an implementation in your app I think :) do you have any idea how this would be coded? Any plan to do it? It looks like code completion is the only openai API you have not implemented.

Thanks and have a nice day!

Error when importing chats from ChatGPT when user uploaded files.

Type of content found in a dict instead of the expected string:

{
"asset_pointer": "file-service://file-XXXXXXXXXXXXXXXXXXXXXXXX",
"content_type": "image_asset_pointer",
"fovea": null,
"height": 482,
"metadata": {
"dalle": null,
"gizmo": null,
"sanitized": true
},
"size_bytes": 26664,
"width": 802
}

Revised function that work from util script.py

def get_chatgpt_data(conv_arr):
    for conv in conv_arr:
        # Initialize the messages list for each conversation
        conv['messages'] = []

        for k, v in conv['mapping'].items():
            obj = {}
            message = v['message']
            
            if message:
                metadata = message['metadata']
                role = message['author']['role']
                create_time = datetime.fromtimestamp(message['create_time']).strftime('%Y-%m-%d %H:%M:%S') if message['create_time'] else None
                update_time = datetime.fromtimestamp(message['update_time']).strftime('%Y-%m-%d %H:%M:%S') if message['update_time'] else None
                content = message['content']

                obj['role'] = role
                obj['insert_dt'] = create_time
                obj['update_dt'] = update_time

                if role == 'user':
                    # Handle the parts of user content
                    content_parts = []
                    for part in content['parts']:
                        if isinstance(part, str):
                            content_parts.append(part)
                        elif isinstance(part, dict):
                            print(f"Encountered a dict in user content parts: {part}")
                            # Handle dict appropriately
                            # Example: content_parts.append(str(part)) or another approach
                            content_parts.append(str(part))  # Convert dict to string for now
                            print (json.dumps(part, sort_keys=True, indent=4))
                        else:
                            print(f"Unknown content type in user content parts: {type(part)}")
                    obj['content'] = '\n'.join(content_parts)
                    conv['messages'].append(obj)
                else:
                    if role == 'tool':
                        # Skip tool role as it's for internal use only
                        continue
                    elif role == 'assistant':
                        model_slug = metadata.get('model_slug', None)
                        obj['model'] = model_slug
                        content_type = content['content_type']
                        
                        if content_type == 'text':
                            # Handle the parts of assistant's text content
                            content_parts = []
                            for part in content['parts']:
                                if isinstance(part, str):
                                    content_parts.append(part)
                                elif isinstance(part, dict):
                                    print(f"Encountered a dict in assistant content parts: {part}")
                                    # Handle dict appropriately
                                    # Example: content_parts.append(str(part)) or another approach
                                    content_parts.append(str(part))  # Convert dict to string for now
                                    print(json.dumps(part, sort_keys=True, indent=4))

                                else:
                                    print(f"Unknown content type in assistant content parts: {type(part)}")
                            obj['content'] = '\n'.join(content_parts)
                            conv['messages'].append(obj)
                        elif content_type == 'code':
                            # Handle code content type appropriately if needed
                            pass
                    elif role == 'system':
                        # Skip system role
                        continue
        
        # Remove mapping key from the conversation
        del conv['mapping']

    return conv_arr

If possiible, support for japanese

Thank you sir for this great work.
I'm Hetareba.
I could save much time with this tool, thanks.
If possible, could you make japanese prompt?
yes, i can use english prompt but i use Japanse much more than English, so japanese prompt will help my work.
it is sad because i don't know how to send you some gift for this work.

No module named 'llama_index.response'

After installing everything from the requirements.txt file, I'm running into the following problem:
No module named 'llama_index.response'

Is the code set up for an old version of llama_index?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.