Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Filters, Template Manager, Dynamic chaarcters list #38

Merged
merged 3 commits into from
Feb 21, 2025

Conversation

VisionOra
Copy link
Collaborator

Risks
Low – Changes are scoped to filtering, template management, and character listing.

Potential risk: UI regressions in template selection.
Mitigation: Manual and automated testing conducted.
Background
What does this PR do?
Fixes the filter issue and Template Manager.
Improves the dynamic character list retrieval from the API.
Ensures smooth selection and updates of templates for characters.
What kind of change is this?
✅ Bug Fix (resolves filtering issue)
✅ Improvement (better character management)
✅ Feature (dynamic character selection)

Documentation changes needed?
✅ No documentation changes required.

@snobbee snobbee changed the title Filters, Template Manager, Dynamic chaarcters list fix: Filters, Template Manager, Dynamic chaarcters list Feb 21, 2025
Copy link

Deploying prosper-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d66c7c
Status:⚡️  Build in progress...

View logs

Copy link

Deploying prosper-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d66c7c
Status: ✅  Deploy successful!
Preview URL: https://461fc3be.realityspiral-dgb.pages.dev
Branch Preview URL: https://filterandtemplate.realityspiral-dgb.pages.dev

View logs

Copy link

Deploying agents-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d66c7c
Status: ✅  Deploy successful!
Preview URL: https://f1856aac.realityspiral.pages.dev
Branch Preview URL: https://filterandtemplate.realityspiral.pages.dev

View logs

Copy link

Deploying prosper-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3f5d39f
Status:⚡️  Build in progress...

View logs

Copy link

Deploying prosper-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3f5d39f
Status: ✅  Deploy successful!
Preview URL: https://697a5d15.realityspiral-dgb.pages.dev
Branch Preview URL: https://filterandtemplate.realityspiral-dgb.pages.dev

View logs

Copy link

Deploying agents-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3f5d39f
Status: ✅  Deploy successful!
Preview URL: https://f21bffd1.realityspiral.pages.dev
Branch Preview URL: https://filterandtemplate.realityspiral.pages.dev

View logs

Comment on lines +1005 to +1007
router.get("/traces/unique-runs", async (req, res) => {
getUniqueRuns(req, res);
});

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
a database access
, but is not rate-limited.

Copilot Autofix AI 7 days ago

To fix the problem, we need to introduce rate limiting to the Express application. The best way to do this is by using the express-rate-limit package, which allows us to set up a rate limiter and apply it to the routes that perform expensive operations.

  1. Install the express-rate-limit package.
  2. Import the express-rate-limit package in the file.
  3. Set up a rate limiter with appropriate configuration (e.g., maximum of 100 requests per 15 minutes).
  4. Apply the rate limiter to the routes that perform expensive operations, such as the route handler on line 1005.
Suggested changeset 2
clients/client-direct/src/api.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/clients/client-direct/src/api.ts b/clients/client-direct/src/api.ts
--- a/clients/client-direct/src/api.ts
+++ b/clients/client-direct/src/api.ts
@@ -5,2 +5,3 @@
 import express from "express";
+import rateLimit from "express-rate-limit";
 import type { Router } from "express";
@@ -42,2 +43,7 @@
 
+const limiter = rateLimit({
+	windowMs: 15 * 60 * 1000, // 15 minutes
+	max: 100, // limit each IP to 100 requests per windowMs
+});
+
 interface UUIDParams {
@@ -1004,3 +1010,3 @@
 	 */
-	router.get("/traces/unique-runs", async (req, res) => {
+	router.get("/traces/unique-runs", limiter, async (req, res) => {
 		getUniqueRuns(req, res);
EOF
@@ -5,2 +5,3 @@
import express from "express";
import rateLimit from "express-rate-limit";
import type { Router } from "express";
@@ -42,2 +43,7 @@

const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // limit each IP to 100 requests per windowMs
});

interface UUIDParams {
@@ -1004,3 +1010,3 @@
*/
router.get("/traces/unique-runs", async (req, res) => {
router.get("/traces/unique-runs", limiter, async (req, res) => {
getUniqueRuns(req, res);
clients/client-direct/package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/clients/client-direct/package.json b/clients/client-direct/package.json
--- a/clients/client-direct/package.json
+++ b/clients/client-direct/package.json
@@ -17,36 +17,39 @@
 	},
-	"files": ["dist"],
-	"dependencies": {
-		"@elizaos/core": "^0.1.9",
-		"@elizaos/plugin-image-generation": "^0.1.9",
-		"@elizaos/plugin-tee-log": "^0.1.9",
-		"@elizaos/plugin-tee-verifiable-log": "^0.1.9",
-		"@realityspiral/client-coinbase": "workspace:*",
-		"@types/body-parser": "1.19.5",
-		"@types/cors": "2.8.17",
-		"@types/express": "5.0.0",
-		"body-parser": "1.20.3",
-		"cors": "2.8.5",
-		"discord.js": "14.16.3",
-		"express": "4.21.1",
-		"multer": "1.4.5-lts.1",
-		"openai": "4.73.0",
-		"pg": "^8.13.3",
-		"swagger-jsdoc": "^6.2.8",
-		"swagger-ui-express": "^5.0.1",
-		"zod": "3.23.8"
-	},
-	"devDependencies": {
-		"@types/multer": "^1.4.12",
-		"@types/node": "^22.13.4",
-		"@types/pg": "^8.11.11",
-		"tsup": "8.3.5"
-	},
-	"scripts": {
-		"build": "tsup --format esm --dts",
-		"dev": "tsup --format esm --dts --watch"
-	},
-	"peerDependencies": {
-		"whatwg-url": "7.1.0"
-	}
+	"files": [
+    "dist"
+  ],
+  "dependencies": {
+    "@elizaos/core": "^0.1.9",
+    "@elizaos/plugin-image-generation": "^0.1.9",
+    "@elizaos/plugin-tee-log": "^0.1.9",
+    "@elizaos/plugin-tee-verifiable-log": "^0.1.9",
+    "@realityspiral/client-coinbase": "workspace:*",
+    "@types/body-parser": "1.19.5",
+    "@types/cors": "2.8.17",
+    "@types/express": "5.0.0",
+    "body-parser": "1.20.3",
+    "cors": "2.8.5",
+    "discord.js": "14.16.3",
+    "express": "4.21.1",
+    "multer": "1.4.5-lts.1",
+    "openai": "4.73.0",
+    "pg": "^8.13.3",
+    "swagger-jsdoc": "^6.2.8",
+    "swagger-ui-express": "^5.0.1",
+    "zod": "3.23.8",
+    "express-rate-limit": "^7.5.0"
+  },
+  "devDependencies": {
+    "@types/multer": "^1.4.12",
+    "@types/node": "^22.13.4",
+    "@types/pg": "^8.11.11",
+    "tsup": "8.3.5"
+  },
+  "scripts": {
+    "build": "tsup --format esm --dts",
+    "dev": "tsup --format esm --dts --watch"
+  },
+  "peerDependencies": {
+    "whatwg-url": "7.1.0"
+  }
 }
EOF
This fix introduces these dependencies
Package Version Security advisories
express-rate-limit (npm) 7.5.0 None
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Comment on lines +1098 to +1100
router.get("/templates/characters", async (req, res) => {
getCharacters(req, res);
});

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
a file system access
, but is not rate-limited.
@snobbee snobbee merged commit 7047977 into main Feb 21, 2025
14 of 15 checks passed
@snobbee snobbee deleted the filterAndTemplate branch February 21, 2025 19:03
monilpat pushed a commit that referenced this pull request Feb 22, 2025
* Filters, Template Manager, Dynamic chaarcters list

* fix(tracer): fix swagger not diplaying endpoints, removed duplicated routes

---------

Co-authored-by: Snobbish Bee <125891987+snobbee@users.noreply.github.com>
monilpat added a commit that referenced this pull request Feb 23, 2025
)

* only sell what you have bought

* add trade specific pnl

* chore: add pre commit auto formatting (#37)

* docs: Update TG on website (#39)

Update TG on website

* feat: Add provider for token address + staking instructions (#40)

* token address + staking instructions

* 2

* address comments

* comments

* docs: Update PROSPER token README.md  (#43)

* Update README.md

* Add files via upload

* Update Prosper token README.md 

Added image from staking website.

* Update PROSPER token README.md

described option for RSP holders to get PROSPER thotugh staking RSP/ETH

* docs: Link to Prosper website from main RS website (#42)

Link to Prosper website from main RS website

* docs: Add stakeprosper.com link in coverpage (#41)

Update _coverpage.md

* chore: fix biome errors (#45)

* fix: Filters, Template Manager, Dynamic chaarcters list (#38)

* Filters, Template Manager, Dynamic chaarcters list

* fix(tracer): fix swagger not diplaying endpoints, removed duplicated routes

---------

Co-authored-by: Snobbish Bee <125891987+snobbee@users.noreply.github.com>

* Update index.ts with bridging instructions (#46)

* only sell what you have bought

* add trade specific pnl

* clean up

* add wiining streak

* formatting

---------

Co-authored-by: Snobbish Bee <125891987+snobbee@users.noreply.github.com>
Co-authored-by: Tim <70578108+TimKozak@users.noreply.github.com>
Co-authored-by: mihai169 <42907887+mihai169@users.noreply.github.com>
Co-authored-by: Master X <sohaibanwaar36@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants