Skip to content

haoshiyou/haoshiyou-uniapp

Repository files navigation

haoshiyou-uniapp

a project for haoshiyou uniapp

Setup

  1. git clone <this repo>
  2. cd <dir> && npm install # install
  3. create .env file with template. See npmjs.org/dotenv for reference.

Ask @xinbenlv for keys.

WECHATY_PUPPET_PADPRO_TOKEN=
MONGODB_URI=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
GOOGLE_MAP_KEY=
AXIOS_BASE_URL=
# ENABLE_BOT=1

MAIL_USER=
MAIL_PASS=
MAIL_SMTP=

  1. npm run dev
  2. open browser with http://localhost:3000

Build Setup

# install dependencies
$ npm install

# serve with hot reload at localhost:3000
$ npm run dev

# build for production and launch server
$ npm run build
$ npm start

# generate static project
$ npm run generate

For detailed explanation on how things work, checkout Nuxt.js docs.

Features

Bot

  • Utils - utility methods to be used

    • isAdmin
    • isWhitelisted
    • isGoodNickname
    • shouldCare
    • isBlacklisted
    • getRelatedUsers
  • Room Action

    • Add to HSY Rooms #tested #tested
    • (Safe)-kick from HSY Rooms #tested
    • Blacklist + Extend #tested
    • Kick #tested
    • Make Room Announcement #tested
    • (maybe)Downsize #tested
    • Record invitation #tested
    • Accept Friendship #tested
    • Record Friendship #tested
  • Intention Parsing

    • SeekInstruction
    • JoinRoom + which room
    • PostListing
  • Info Extraction

    • [3] Extract Text with haoshiyou-ai
    • [1] Record contact information
    • Download Image, downsample and upload to Cloudinary, Get ID #tested
  • Other

  • [3] Downsize friendships? not so soon

  • Use cronjob to post announcement

  • Use npmjs.org/bottleneck to limit rate

UI

  • [1] Launch bot from server
  • [1] Show QR-code
  • [1] Show List
  • [1] Show Map
  • [1] Show Detail
  • [2] Bot status page behind admin

MongoDB schema

{
  // Message
  Message: {
    _id: "message.id"
  },
  // MessageMeta
  MessageMeta: {
    _id: "message.id"
  },

  // Contact
  ContactMeta: {
    _id: "contact.id",
    isAdmin: "boolean",
    isWhitelisted: "boolean",
    isBlacklisted: "boolean",
    invited: [
      {
        inviteeId: "string",
        timestamp: "datetime",
        roomId: "string"
      }
    ],
    invitedBy: [
      {
        inviterId: "string",
        timestamp: "datetime",
        roomId: "string"
      }
    ],
    blacklistedRecords: [
      {
        adminId: "string",
        timestamp: "datetime",
        direct: "boolean", // true for direct blacklist, false for indirect blacklist (caused by related user being blacklisted)
        causeContactId: "string",
        degreeOfExtension: "number"
      }
    ],
    friendship: [
      {
        type: "Enum<string>", // {"friend", "unfriend"}
        timestamp: "datetime"
      }
    ]
  },

  // ContactMeta
  Contact: {
    _id: "contact.id"
  },

  // HsyListing
  HsyListing: {
   // see schemas/HsyListingInterface.ts
  }
}

WECHATY_PUPPET_PADPRO_TOKEN=
MONGODB_URI=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
GOOGLE_MAP_KEY=
AXIOS_BASE_URL=

Next Generation

// intent framework // message comes in, getting the intent, or collectively getting intent // when more intent is getting in emit intent and intent state // intent, knowledge, intent related knowledge