Coder Social home page Coder Social logo

Comments (4)

snowby666 avatar snowby666 commented on June 3, 2024 1

I've just resolved this. You can update the lib now.

from poe-api-wrapper.

snowby666 avatar snowby666 commented on June 3, 2024

can you specify what files you uploaded?
and the code you used here?

from poe-api-wrapper.

phamxtien avatar phamxtien commented on June 3, 2024

File upload: info.txt
Code:

import getDuckDuckRegion
from poe_api_wrapper import PoeApi

m_b = '....'

def search(engine, prompt, id=''):
    region = getDuckDuckRegion(prompt)
    if (prompt.strip()).startswith('#search:'):
        keywords = [prompt.replace('#search:', '')]
        act = keywords
    else:
        prompt = prompt.split('#search:')
        keywords = prompt[1].strip().split('\n')
        act = prompt[0]
    count = 15
    if len(keywords) > 1: count = 5
    ddg = ddgSearch(keywords=keywords, region=region, count=count)
    i = 1
    links = ''
    for url in ddg['urls']:
        links = links + f'[{i}] {url}\n'
        i = i + 1
    documents = ' '.join(ddg['documents'])

    temp_path = f'{getConfPath()}{os.sep}info.txt'
    if os.path.exists(temp_path): os.remove(temp_path)
    prompt = f'{prompt}#file::{temp_path}'
    
    return poeChat(prompt, engine, id)
    

def poeChat(prompt, engine='', id=''):    
    file_path = []
    if '#file::' in prompt:
        file_path = prompt.split('#file::')[1].strip()
        file_path = file_path.split('\n')
        prompt = prompt.split('#file::')[0]

    client = PoeApi(m_b)
    if id !='':
        id = id.split(' ')
        response = client.send_message('gpt3_5', prompt, chatCode=id[0], chatId=int(id[1]), file_path=file_path)
    else:
        response = client.send_message('gpt3_5', prompt, file_path=file_path)
    for chunk in response:
        pass
        
    chatCode = chunk["chatCode"]
    chatId = chunk["chatId"]
    
    return {'RESULT': True, 'ID': f'{chatCode} {chatId}', 'DATA': chunk['text']}

It run smooth if not attach file

from poe-api-wrapper.

jnikhilreddy avatar jnikhilreddy commented on June 3, 2024

Yeah i am facing the same error too when i try to upload file

from poe-api-wrapper.

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.