Giter Site home page Giter Site logo

Comments (12)

danni-cool avatar danni-cool commented on May 21, 2024

先判断type,再条件化解析content

from wechatbot-webhook.

lucasjinreal avatar lucasjinreal commented on May 21, 2024

@danni-cool thank u, 已解决。

那个post的想法,其实就是想实现这么一个功能:

@app.post("/wc_receive")
def handle_wcbot_msg_receive_callback(type: str = Form(...),
                                      ...
                                      isSystemEvent: Optional[str] = Form(None)):
    if type == 'text':
        # send msg from http://localhost:3001/webhook/msg
        room = source['room']
        from_part = source['from']
        print(source)
        if room != "":
            print('msg from room: ', room['payload']['topic'])
        else:
            from_name = from_part['payload']['name']
            print('msg from: ', from_name)
        print(content)
        # get id and resend

        rsp = llm(content)
        return {"text": rsp}

在这里return 一个回复,有办法可以实现吗?

from wechatbot-webhook.

danni-cool avatar danni-cool commented on May 21, 2024

不能,独立于不同网段的http服务,用python也没法实现这个功能吧,你这种适合组装功能在一起

from wechatbot-webhook.

lucasjinreal avatar lucasjinreal commented on May 21, 2024

不是,我的意思是不是客户端post的这个请求吗? 为什么不能把post的返回利用起来呢

from wechatbot-webhook.

lucasjinreal avatar lucasjinreal commented on May 21, 2024

客户端不是本身就可以提供http访问推送消息吗? 那我理解客户端应该具备给某个用户发消息的能力,直接把post的返回推送给发送方,就实现了回复拦截、处理、再回应的功能.

不然的话,就必须得两台服务

from wechatbot-webhook.

danni-cool avatar danni-cool commented on May 21, 2024

这些都可以实现,只是这样的业务很重,拦截处理再回应,这种更像sdk该干的活。

我的服务走 http 接口,本身就是为了把繁琐的服务独立于这个收发体系之外,就像微信只是个工具,你的大脑去想要发什么。

如果既不想直接改代码,又要做拦截器、自定义回复,又要考虑不同语言之间兼容性你会如何设计?

from wechatbot-webhook.

lucasjinreal avatar lucasjinreal commented on May 21, 2024

我看了一下,eatapple的那个wechat sdk golang的似乎更好一点,自由度高

from wechatbot-webhook.

danni-cool avatar danni-cool commented on May 21, 2024

我看了一下,eatapple的那个wechat sdk golang的似乎更好一点,自由度高

你的需求要的是一个SDK

from wechatbot-webhook.

danni-cool avatar danni-cool commented on May 21, 2024

客户端不是本身就可以提供http访问推送消息吗? 那我理解客户端应该具备给某个用户发消息的能力,直接把post的返回推送给发送方,就实现了回复拦截、处理、再回应的功能.

不然的话,就必须得两台服务

@lucasjinreal 今天又考虑了下这个问题,确实post请求利用起来,就只要一台公网的ip服务器,最近正在实现这点

from wechatbot-webhook.

lucasjinreal avatar lucasjinreal commented on May 21, 2024

对的,其实这是双向回路的一个特例:当且仅当及时回复的场景适用,例如聊天AI。
实现好了叫我

from wechatbot-webhook.

danni-cool avatar danni-cool commented on May 21, 2024

对的,其实这是双向回路的一个特例:当且仅当及时回复的场景适用,例如聊天AI。 实现好了叫我

ok,碰巧在实现好友邀请时考虑到这个问题,但是如果大量slave机器post请求到你服务器,是不是得考虑并发问题

from wechatbot-webhook.

lucasjinreal avatar lucasjinreal commented on May 21, 2024

我以前考虑的是给用户用,但是这得让服务器登录许多个微信,感觉不太现实,如果只是我的微信,那就只是回复艾特我的消息了。
考虑到微信的频率限制,这个频次应该不会太高

from wechatbot-webhook.

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.