Giter Site home page Giter Site logo

Comments (15)

chrislemke avatar chrislemke commented on July 28, 2024 1

This release (1.2.2) should work.

from chatfred.

CullumAttwell avatar CullumAttwell commented on July 28, 2024 1

Hi @chrislemke,

I just uninstalled and reintalled via your link and this is the error that came through on the debug viewer:

[23:27:58.792] ChatFred[Keyword] Processing complete
[23:27:58.797] ChatFred[Keyword] Passing output 'asdfasdf' to Run Script
[23:27:59.120] ERROR: ChatFred[Run Script] Traceback (most recent call last):
  File "/.../Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.BBAFA9DD-4B66-4BDE-8042-BD93A6FE29FA/src/text_chat.py", line 153, in make_chat_request
    openai.ChatCompletion.create(
AttributeError: module 'openai' has no attribute 'ChatCompletion'. Did you mean: 'Completion'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.BBAFA9DD-4B66-4BDE-8042-BD93A6FE29FA/src/text_chat.py", line 186, in <module>
    __prompt, __response = make_chat_request(
  File "/.../Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.BBAFA9DD-4B66-4BDE-8042-BD93A6FE29FA/src/text_chat.py", line 167, in make_chat_request
    response = exception_response(exception)
  File "/.../Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.BBAFA9DD-4B66-4BDE-8042-BD93A6FE29FA/src/error_handling.py", line 74, in exception_response
    if isinstance(error, openai.error.Timeout):
AttributeError: module 'openai.error' has no attribute 'Timeout'
[23:27:59.130] ChatFred[Run Script] Processing complete
[23:27:59.131] ChatFred[Run Script] Passing output '' to Large Type
[23:27:59.132] ChatFred[Run Script] Passing output '' to Conditional
[23:27:59.133] ChatFred[Run Script] Passing output '' to Conditional
[23:27:59.134] ChatFred[Conditional] Processing complete
[23:27:59.135] ChatFred[Conditional] Passing output '' to Copy to Clipboard
[23:27:59.136] ChatFred[Copy to Clipboard] Processing complete
[23:27:59.137] ChatFred[Copy to Clipboard] Passing output '' to Conditional

Let me know if there is anything else I can assist with.

Thanks

from chatfred.

CullumAttwell avatar CullumAttwell commented on July 28, 2024 1

You've cracked it! It seems that my mac no longer had Python installed after an update.

Thanks for all your help with this!

from chatfred.

CullumAttwell avatar CullumAttwell commented on July 28, 2024 1

Yes - it works splendidly. Thanks for all your work on this!

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Hey @han-ysys!
Sorry for this. I already found the bug (at least I hope) and will provide a new release soon. If you want to fix it on your machine you can simply the following code in the text_chat.py file.

def read_from_log() -> list[str]:
    """Reads the log file and returns the last __history_length lines."""
    history: list[str] = []
    if os.path.isfile(__log_file_path) is False:
        return history

    with open(__log_file_path, "r", encoding="utf-8") as log_file:
        logs = log_file.readlines()

    for line in logs:
        line = line.replace("\n", "")
        history.append(line)

    return history[: __history_length * 2]

by:

def read_from_log():
    """Reads the log file and returns the last __history_length lines."""
    history = []
    if os.path.isfile(__log_file_path) is False:
        return history

    with open(__log_file_path, "r", encoding="utf-8") as log_file:
        logs = log_file.readlines()

    for line in logs:
        line = line.replace("\n", "")
        history.append(line)

    return history[: __history_length * 2]

Alternatively you can update your Python Version to >= 3.10.

from chatfred.

CullumAttwell avatar CullumAttwell commented on July 28, 2024

Hi Chris

Just a heads up - I had the same issue and the suggested code fix above did not seem to work for me. Will the most recent release be live on the Alfred Gallery soon?

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Hey! Version 1.2.2. should already be online: https://alfred.app/workflows/chrislemke/chatfred/

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Hey @CullumAttwell!
Do you get the same error message?

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Hi @CullumAttwell,
thanks for providing this information. This is a strange error.

AttributeError: module 'openai' has no attribute 'ChatCompletion'.

Since ChatCompletion obviously does exist I have a bit of the feeling that an old version of the OpenAI packages - for some reason still remains on your machine.

Could you navigate to: ~/Apps/Alfred/Alfred.alfredpreferences/workflows/user.workflow.THE ID OF THE CHATFRED WORKFLOW/src/libs/openai/__init__.py. Alternatively you can make right-click on the workflow and an Open in Finder and then navigate from the to the /src/libs/openai/__init__.py destination.

Right at the top you should find:

from openai.api_resources import (
    Audio,
    ChatCompletion,
    Completion,
    Customer,
    Edit,
    Deployment,
    Embedding,
    Engine,
    ErrorObject,
    File,
    FineTune,
    Image,
    Model,
    Moderation,
)

If it does not contain ChatCompletion we know your machine has the old package/files and you can simply install the new version.

Same applies for the AttributeError: module 'openai.error' has no attribute 'Timeout' error.

from chatfred.

CullumAttwell avatar CullumAttwell commented on July 28, 2024

Morning @chrislemke,

Thanks for your response.

I have just tested this out and I can confirm that I have ChatCompletion within the specificed file.

I completed a fresh install from https://alfred.app/workflows/chrislemke/chatfred/ but the issue still persists.

On a side note, I have realised that I am able to use the "cft" part of the worflow (I was unaware of this before) but the "cf" and "cfi" commands still allude me.

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Thanks for the quick update. What error you are getting if you try cfi?

from chatfred.

CullumAttwell avatar CullumAttwell commented on July 28, 2024
[09:14:43.118] ChatFred[Keyword] Passing output 'tester' to Run Script
[09:14:43.336] ERROR: ChatFred[Run Script] Traceback (most recent call last):
  File "/.../Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8D40654A-A2DC-483E-87C4-16AF50908560/src/image_generation.py", line 67, in make_request
    response = openai.Image.create(prompt=prompt, n=1, size=f"{size}x{size}")
AttributeError: module 'openai' has no attribute 'Image'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8D40654A-A2DC-483E-87C4-16AF50908560/src/image_generation.py", line 85, in <module>
    __response = make_request(get_query(), __size)
  File "/.../Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8D40654A-A2DC-483E-87C4-16AF50908560/src/image_generation.py", line 75, in make_request
    error_message=exception._message,  # type: ignore  # pylint: disable=protected-access
AttributeError: 'AttributeError' object has no attribute '_message'
[09:14:43.348] ChatFred[Run Script] Processing complete
[09:14:43.350] ChatFred[Run Script] Passing output '' to Conditional
[09:14:43.351] ChatFred[Conditional] Processing complete
[09:14:43.352] ChatFred[Conditional] Passing output '' to Large Type

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Maybe you can provide information like:

  • Python version
  • Alfred version
  • MacOS version

Does "fresh install" means you removed the old workflow version before you installed the new one?

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Wow nice! I hope it works now for you?!

from chatfred.

chrislemke avatar chrislemke commented on July 28, 2024

Great! You are welcome! Enjoy using it. And please feel free to suggest any new features you would like to have or report any bug you encounter!

from chatfred.

Related Issues (20)

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.