Skip to content

Instantly share code, notes, and snippets.

View AmoDinho's full-sized avatar
:bowtie:
Taking it one byte at a time.

Amo Moloko AmoDinho

:bowtie:
Taking it one byte at a time.
View GitHub Profile
@AmoDinho
AmoDinho / prompt.md
Created August 19, 2025 17:50
Prompt for additional tools in chainlit
  • create a generic tool result function
  • create a handle_screenshot_result function.

the handle_screenshot_result function should run when the tool name == browser_take_screenshot or browser_snapshot

the handle_screenshot_result function to get the screenshot that the mcp server has taken and render it in a message.

this is how chainlit renders messages with images:

// Package Imports
// Internal Imports
import { eventDetailTypes, locationServiceKeys } from "../../../../libs/constants";
import { cloudLogs } from "../../../../libs/utils";
const TrackingStoppedHandler = async (event) => {
try {
// CHECK - JSON Payload in Request
if (event["detail-type"] !== eventDetailTypes.trackingStopped) throw "Payload type does not match required value - trackingStopped";
import { formater } from "../../libs/constants";
const AWS = require("aws-sdk");
AWS.config.update({ region: "eu-west-1" });
const SES = new AWS.SES();
export function handler(event, context, callback) {
const data = JSON.parse(event.Records[0].body);
@AmoDinho
AmoDinho / s3EventTrigger.js
Created February 25, 2024 11:45
A Lambda function that receives an event from s3 and then writes the data to DynamoDB.
import { failure, success } from '../../libs/response-lib';
import { updateLoad } from '../../libs/dynamoHelper';
import { setLoadUpdateStatusToDelivered } from '../../externalResourceReferences/setLoadUpdateStatusToDelivered';
import { removeLoadsAssetsDB, updateLoadsAssetsDB } from './s3LoadsAssets';
const parseDataFromUploadEvent = (bucketName, record) => {
const buildObjectLocation = (bucketName, filename) => {
const region = process.env.region;
return `https://${bucketName}.s3.${region}.amazonaws.com/${filename}`;
};
@AmoDinho
AmoDinho / mountainReducer.js
Created March 24, 2021 21:25
Mountain Reducer
export const addNewMountain = (state, action) => {
state.mountains.push(action.payload);
return state;
};
@AmoDinho
AmoDinho / Mountains.js
Created March 24, 2021 21:24
Mountains page
import React, { useState, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { addMountain } from "../slices/mountainsSlice";
import { setPageHeader } from "../slices/layoutSlice";
const Mountains = (props) => {
const [mountainName, setMountainName] = useState("");
const mountains = useSelector((state) => state.mountain.mountains);
const dispatch = useDispatch();
@AmoDinho
AmoDinho / Home.js
Created March 24, 2021 21:23
Home page of Recoil App
import React, { useEffect } from "react";
import { useDispatch } from "react-redux";
import { setPageHeader } from "../slices/layoutSlice";
import HeadingOne from "../components/HeadingOne";
const Index = () => {
const dispatch = useDispatch();
useEffect(() => {
dispatch(setPageHeader("index"));
}, []);
@AmoDinho
AmoDinho / App.js
Created March 24, 2021 21:22
App entry
import React, { useEffect } from "react";
import {useSelector } from "react-redux";
import Routes from "./routes";
const App = () => {
const title = useSelector((state) => state.layout.pageHeader);
return (
<div className="text-center">
{title}
<Routes />
</div>
@AmoDinho
AmoDinho / layoutReducer.js
Created March 24, 2021 21:22
Layout Reducer
export const setNewTitle = (state, action) => {
state.pageHeader = action.payload;
return state;
};
@AmoDinho
AmoDinho / layoutSlice.js
Created March 24, 2021 21:21
Layout Slice
import { createSlice } from "@reduxjs/toolkit";
import { setNewTitle } from "../reducers/layoutReducers";
export const layoutSlice = createSlice({
name: "layout",
initialState: {
pageHeader: "Page",
},
reducers: {
setPageHeader: (state, action) => setNewTitle(state, action),
},