diff --git a/README.md b/README.md new file mode 100644 index 0000000..c0d57e8 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Miaomiaomiao + +A proxy. + +## Usage + +```bash +npm install +``` + +then set the environment variable (see code) and + +```bash +node index +``` + +## Limitations + +Only Anthropic API format is supported. + +Messages will be squashed into question: ... answer: ... format. + +File mode will be used when encodeURIComponent(prompt) > 32K + diff --git a/index.js b/index.js index b871eea..47be868 100644 --- a/index.js +++ b/index.js @@ -5,9 +5,10 @@ const app = express(); const axios = require("axios"); const port = 8080; -(axios.defaults.headers.common["User-Agent"] = - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"), - (axios.defaults.headers.common["Cookie"] = process.env.YOUCOM_COOKIE); +axios.defaults.headers.common["User-Agent"] = + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"; +axios.defaults.headers.common["Cookie"] = process.env.YOUCOM_COOKIE; + app.post("/v1/messages", (req, res) => { req.rawBody = ""; @@ -227,6 +228,7 @@ app.post("/v1/messages", (req, res) => { throw new Error("Invalid request"); } } catch (e) { + console.log(e); res.write(JSON.stringify({ error: e.message })); res.end(); return;