Avatar

all

Joined August 17, 2024
Likes
19
iamseeley avatar
valTownUser
@iamseeley
Script
👤 valTownUser The valTownUser object provides a convenient interface to interact with Val Town's API and access user-specific information and functionalities. User Information getUserInfo() Fetches and caches the user's information. Use case: Retrieving all user details at once. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getUserInfo = () => valTownUser.getUserInfo(); // Example usage: const userInfo = await getUserInfo(); console.log('User Information:', userInfo); // You can also destructure specific properties you need: const { username, id, email, tier } = await getUserInfo(); console.log(`Username: ${username}`); console.log(`User ID: ${id}`); console.log(`Email: ${email}`); console.log(`Account Tier: ${tier}`); getUsername() Retrieves the user's username. Use case: Displaying the current user's name in a val. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getUsername = () => valTownUser.getUsername(); // Example usage: const username = await getUsername(); console.log(`Current user: ${username}`); getId() Retrieves the user's ID. Use case: Using the user ID for database queries or API calls. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getId = () => valTownUser.getId(); // Example usage: const userId = await getId(); console.log(`User ID: ${userId}`); getBio() Retrieves the user's biography. Use case: Displaying the user's bio on a profile page. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getBio = () => valTownUser.getBio(); // Example usage: const bio = await getBio(); console.log(`User bio: ${bio || 'Not set'}`); getProfileImageUrl() Retrieves the URL of the user's profile image. Use case: Showing the user's avatar in a val. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getProfileImageUrl = () => valTownUser.getProfileImageUrl(); // Example usage: const profileImageUrl = await getProfileImageUrl(); console.log(`Profile image URL: ${profileImageUrl || 'Not set'}`); getEmail() Retrieves the user's email address. Use case: Sending notifications or verifications. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getEmail = () => valTownUser.getEmail(); // Example usage: const email = await getEmail(); console.log(`User email: ${email}`); getTier() Retrieves the user's account tier. Use case: Implementing tier-specific features. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getTier = () => valTownUser.getTier(); // Example usage: const tier = await getTier(); console.log(`User tier: ${tier}`); URL Generation getEndpointUrl(valName) Generates the endpoint URL for a specified val. Use case: Creating links to val endpoints in your application. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getEndpointUrl = (valName: string) => valTownUser.getEndpointUrl(valName); // Example usage: const endpointUrl = await getEndpointUrl('mySitesServer'); console.log(`Endpoint URL: ${endpointUrl}`); getValUrl(valName) Generates the Val Town URL for a specified val. Use case: Creating links to val pages in Val Town. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getValUrl = (valName: string) => valTownUser.getValUrl(valName); // Example usage: const valUrl = await getValUrl('myVal'); console.log(`Val URL: ${valUrl}`); User Activity getLikedVals(options) Retrieves the vals liked by the user. Use case: Displaying a list of the user's favorite vals. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getLikedVals = (options = {}) => valTownUser.getLikedVals(options); // Example usage: const likedVals = await getLikedVals({ limit: 5 }); console.log('Liked vals:', likedVals.data); getComments(options) Retrieves comments related to the user. Use case: Showing a user's comment history. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getComments = (options = {}) => valTownUser.getComments(options); // Example usage: const comments = await getComments({ limit: 10, relationship: 'given' }); console.log('User comments:', comments.data); getReferences(options) Retrieves references to the user's vals. Use case: Tracking how often a user's vals are used by others. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getReferences = (options = {}) => valTownUser.getReferences(options); // Example usage: const references = await getReferences({ limit: 5 }); console.log('Val references:', references.data); Blob Management listBlobs(prefix) Lists the user's blobs. Use case: Displaying a file manager for the user's stored data. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const listBlobs = (prefix?: string) => valTownUser.listBlobs(prefix); // Example usage: const blobs = await listBlobs(); console.log('User blobs:', blobs); storeBlob(key, data) Stores a new blob or updates an existing one. Use case: Uploading user files or storing large datasets. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const storeBlob = (key: string, data: any) => valTownUser.storeBlob(key, data); // Example usage: await storeBlob('myFile.txt', 'Hello, World!'); console.log('Blob stored successfully'); getBlob(key) Retrieves a specific blob. Use case: Downloading a user's stored file. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getBlob = async (key: string) => { const blobData = await valTownUser.getBlob(key); return new TextDecoder().decode(new Uint8Array(blobData)); }; // Example usage: const blobContent = await getBlob('myFile.txt'); console.log('Blob content:', blobContent); deleteBlob(key) Deletes a specific blob. Use case: Removing old or unnecessary files. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const deleteBlob = (key: string) => valTownUser.deleteBlob(key); // Example usage: await deleteBlob('myFile.txt'); console.log('Blob deleted successfully'); Val Management listVals(options) Lists the user's vals. Use case: Displaying a dashboard of the user's created vals. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const listVals = (options = {}) => valTownUser.listVals(options); // Example usage: const userVals = await listVals({ limit: 5 }); console.log('User vals:', userVals.data); createVal(valInfo) Creates a new val. Use case: Programmatically creating vals based on user input. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const createVal = (valInfo: any) => valTownUser.createVal(valInfo); // Example usage: const newVal = await createVal({ name: 'myNewVal', code: 'console.log("Hello, World!");' }); console.log('Created val:', newVal); updateVal(valId, updates) Updates an existing val. Use case: Implementing an "edit val" feature in your application. deleteVal(valId) Deletes a specific val. Use case: Allowing users to remove their vals through your interface. SQLite Database Operations executeSqlite(statement) Executes a SQLite statement. Use case: Running custom queries on the user's database. listTables() Lists all tables in the user's SQLite database. Use case: Displaying the structure of a user's database. getTableSchema(tableName) Retrieves the schema of a specific table. Use case: Showing the structure of a particular table. getTableContent(tableName, limit) Retrieves the content of a specific table. Use case: Displaying the data stored in a user's table.
hasparus avatar
czarkowyEdytorDat
@hasparus
HTTP
* This app allows users to drop an image onto the canvas, add text to it, move the text around, * edit the text directly on the canvas, and save the result to their local disk. * We'll use the HTML5 Canvas API for image manipulation and the File System Access API for saving files.
stevekrouse avatar
zod_demo_shared
@stevekrouse
Script
An interactive, runnable TypeScript val by stevekrouse
willthereader avatar
ReadmeWriter
@willthereader
Script
Forked from nbbaier/readmeGPT
iamseeley avatar
convertResume
@iamseeley
HTTP (deprecated)
convert your resume content to the json resume standard
maxm avatar
animatedReadmeSVG
@maxm
HTTP (deprecated)
Fancy animated SVGs in readmes, along with centering and image sizing. <div align="center"><img width=200 src="https://gpanders.com/img/DEC_VT100_terminal.jpg"></div> <p align="center"> <img src="https://maxm-animatedreadmesvg.web.val.run/comet.svg" /> </p> <p align="center"> <img src="https://maxm-animatedreadmesvg.web.val.run/custom text!" /> </p>
iamseeley avatar
Server2
@iamseeley
HTTP (deprecated)
🚧 hono + htmx web app 🚧 idea: linktree-esque profile page w/ widgets powered by vals setup: fork the val and uncomment the /signup and /login routes create a jwt secret token environment variable go to the db setup val and run it to create the tables (as the site is right now, you can only add/edit users and add/edit/delete user links) to do: [ ] create some val town apis for the profile widgets (add vals people have already made) [ ] add profile image (will probably point to val town profile pic) [ ] add delete profile handler [ ] finish public profile page [ ] 🎨🎨🎨🎨🎨
neverstew avatar
blobDirList
@neverstew
Script
List things in a blob directory Blobs can be organised using "directories" e.g. /animals all-animals.txt /dogs sausage.txt /cats tom.txt is really only three files: /animals/all-animals.txt , /animals/dogs/sausage.txt and /animals/cats/tom.txt because directories don't really exist, we're just making longer filenames. When you want to list things only "in a directory" and none of the child "directories", you can use this val. import { blobDirList } from "https://esm.town/v/neverstew/blobDirList"; console.log(await blobDirList("/animals")); // returns only "/animals/all-animals.txt"
andreterron avatar
renderFormAndSaveData
@andreterron
HTTP (deprecated)
Render form and save data This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data. Fork this val to customize it and use it on your account.
postpostscript avatar
blogSqliteUniversePart2
@postpostscript
HTTP (deprecated)
sqliteUniverse: Make SQLite Queries Against Multiple Endpoints in Deno (Val Town) (Part 2) If you haven't already, check out Part 1 for an overview of this system! Examples Example: find my vals that are related to my public tables import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; import { sqliteUniverse } from "https://esm.town/v/postpostscript/sqliteUniverse"; console.log(await Statement` SELECT v.name AS val, t.name AS "table" FROM "https://postpostscript-sqlitevals.web.val.run/vals" v INNER JOIN "https://postpostscript-sqlitepublic.web.val.run/sqlite_schema" t ON t.name LIKE ('https://postpostscript-sqlitepublic.web.val.run/' || v.name || '%') AND t.type = 'table' WHERE v.author_username = 'postpostscript' `.execute({ sqlite: sqliteUniverse, })) Since table names matching /^@/ will let you pass val names in the place of their HTTP endpoints, we can write the query as: SELECT v.name AS val, t.name AS "table" FROM "@postpostscript/sqliteVals/vals" v INNER JOIN "@postpostscript/sqlitePublic/sqlite_schema" t ON t.name LIKE ('@postpostscript/sqlitePublic/' || v.name || '%') AND t.type = 'table' WHERE v.author_username = 'postpostscript' The result for the latter: [ { val: "authId", table: "@postpostscript/sqlitePublic/authIdExampleComments_comment" }, { val: "authIdExampleComments", table: "@postpostscript/sqlitePublic/authIdExampleComments_comment" } ] Example: query against a backup import { sqliteFromBlob } from "https://esm.town/v/postpostscript/sqliteBackup"; import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; import { defaultPatterns, patterns, sqliteUniverseWithOptions } from "https://esm.town/v/postpostscript/sqliteUniverse"; const sqlite = sqliteUniverseWithOptions({ interfaces: { patterns: [ ...defaultPatterns, patterns.blob, ], }, }); console.log(await Statement` SELECT * FROM "blob://backup:sqlite:1709960402936/someTable" `.execute({ sqlite })); Example: query from @std/sqlite and public data simultaneously import { sqliteFromBlob } from "https://esm.town/v/postpostscript/sqliteBackup"; import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; import { defaultPatterns, sqliteUniverseWithOptions } from "https://esm.town/v/postpostscript/sqliteUniverse"; import { sqlite as sqlitePrivate } from "https://esm.town/v/std/sqlite?v=4"; const sqlite = sqliteUniverseWithOptions({ interfaces: { patterns: defaultPatterns, fallback({ endpoint, tables }) { return sqlitePrivate }, }, }); console.log(await Statement` SELECT t.*, p.* FROM privateTable t JOIN "@example/sqlitePublic/publicTable" p `.execute({ sqlite })); You could also do it like this to make it more explicit: const sqlite = sqliteUniverseWithOptions({ interfaces: { exact: { "@std/sqlite": sqlitePrivate, }, patterns: defaultPatterns, }, }); console.log(await Statement` SELECT t.*, p.* FROM "@std/sqlite/privateTable" t JOIN "@example/sqlitePublic/publicTable" p `.execute({ sqlite })); Next Steps I'd like to make patterns to allow queries against JSON and Val/ESM exports e.g. SELECT * FROM "json://example.com/example.json" or SELECT * FROM "export://@postpostscript/someVal/someExport" but those will have to come later! Another necessary feature for querying against larger databases will be to use the WHERE or JOIN conditions when dumping from them, but this will be more complicated P.S. This has been a super fun project to work on and I hope you find it interesting or inspiring too! Let me know if you find any errors in this post or if you'd like me to expand more on a specific feature, and let me know if you make anything cool with this and I'll make a note of it! P.P.S (😏) this interface is not 100% stable yet, so I would recommend pinning to specific versions if it not breaking is important to you P.P.P.S. Want to serve your own public SQLite endpoints? This is currently the simplest example I have of how to do that: @postpostscript/sqlitePublic
postpostscript avatar
blogSqliteUniverse
@postpostscript
HTTP (deprecated)
sqliteUniverse: Make SQLite Queries Against Multiple Endpoints in Deno (Val Town) (Part 1) Prerequisite Knowledge Val Town-Hosted SQLite Val Town hosts SQLite as part of its standard library ( @std/sqlite ). This makes a fetch request against their closed-source API (using your API token) which returns results in a consistent format. This is great because you can host your own endpoints that work similarly, and reuse code that was only designed in mind for that original hosted interface The standard format (abridged to important fields): POST /execute { "statement": { "sql": "SELECT * FROM some_table", "args": [] } } Output: { "rows": [[1, "first", 1709942400], [2, "second", 1709942401]], "columns": ["id", "name", "lastModified"] } POST /batch { "statements": [ { "sql": "INSERT INTO some_table VALUES (?, ?, ?)", "args": [3, "third", 1709942402] }, { "sql": "SELECT * FROM some_table", "args": [] } ] } Output: [ { "rows": [], "columns": ["id", "name", "lastModified"] }, { "rows": [[1, "first", 1709942400], [2, "second", 1709942401], [3, "third", 1709942402]], "columns": ["id", "name", "lastModified"] }, ] SQLite in Wasm There is a deno package (sqlite) which lets you (among other things) create SQLite databases in-memory using WebAssembly. I've created a Val which wraps this to enable it to be a drop-in replacement for @std/sqlite: @postpostscript/sqliteWasm Example import { createSqlite } from "https://esm.town/v/postpostscript/sqliteWasm"; import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; const sqlite = createSqlite(); console.log(sqlite.batch([ Statement` CREATE TABLE test ( id TEXT PRIMARY KEY, value TEXT ) `, Statement` INSERT INTO test VALUES ( ${"some-id"}, ${"some-value"} ) `, Statement` SELECT * FROM test `, ])) Result: [ { rows: [], rowsAffected: 0, columns: [] }, { rows: [], rowsAffected: 1, columns: [] }, { rows: [ [ "some-id", "some-value" ] ], rowsAffected: 0, columns: [ "id", "value" ] } ] Dump Tool I have modified @nbbaier's great work at @postpostscript/sqliteDump to support dumping from any sqlite interface, whether the standard library's version, over HTTP, or through the above Wasm implementation Putting it All Together All of the above enables: Serving a subset of your private data publicly for others to query (Example: @postpostscript/sqlitePublic ) Backing up your database and querying against that backup (via @postpostscript/sqliteBackup's sqliteFromBlob and sqliteToBlob ) But we can do more..! What if we could query from multiple of these data sources.. at the same time! 😱 sqliteUniverse sqliteUniverse is an @std/sqlite compatible interface that determines where a table should route to based on different patterns Table Name Patterns The actual table name will always come after a "/", with the exception of tables without any endpoint, for example users . Everything before the last "/" is the endpoint name. Endpoint interfaces will be chosen in the following order: Exact match in options.interfaces.exact e.g. @std/sqlite/someTable would match options.interfaces.exact["@std/sqlite"] Each pattern in options.interfaces.patterns options.interfaces.fallback will be called An error is thrown if none of the above matches AND returns an sqlite interface. If there is a match but the handler returns nothing, it will continue down the list Default options.interfaces.patterns : patterns.https - /^https:\/\// ( https://example.com/somePath/tableName ): fetch from https://example.com/somePath/batch patterns.val - /^@/ ( @author/name/somePath/tableName ): fetch from the val's endpoint, https://author-name.web.val.run/somePath/batch Other Available Patterns: The following patterns are accessible through import { patterns } from "https://esm.town/v/postpostscript/sqliteUniverse" : patterns.blob - /^blob:\/\// ( blob://backup:sqlite:1709960402936 ) - import the database from private blob backup:sqlite:1709960402936 Overriding Default Options The sqliteUniverse export contains defaults insuring no private data will be leaked. If you want to reduce or extend these options, use the sqliteUniverseWithOptions export and pass a modified interfaces option in the first argument: Examples of how to set options.interfaces.exact , options.interfaces.patterns , and options.interfaces.fallback : import { sqliteUniverseWithOptions, patterns, defaultPatterns } from "https://esm.town/v/postpostscript/sqliteUniverse"; import { createSqlite } from "https://esm.town/v/postpostscript/sqliteWasm"; import { sqliteFromAPI } from "https://esm.town/v/postpostscript/sqliteFromAPI"; import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; const sqlite = sqliteUniverseWithOptions({ interfaces: { exact: { // `SELECT * FROM "some-endpoint/someTable"` will match // `SELECT * FROM "some-endpoint/somePath/someTable"` will NOT match "some-endpoint": ({ endpoint, tables }) => { const sqlite = createSqlite() sqlite.batch([ Statement`CREATE TABLE someTable (someField TEXT PRIMARY KEY)`, Statement`INSERT INTO someTable VALUES (${"some-field"})` ]) return sqlite }, }, patterns: [ ...defaultPatterns, [ // shorthand e.g. ~/sqlitePublic -> @postpostscript/sqlitePublic /^~\/(\w+)/, ({ endpoint, tables, match }) => { return sqliteFromAPI(`@postpostscript/${match[1]}`) }, ] ], fallback({ endpoint, tables }) { // if an endpoint is not found, this will be called return sqliteFromAPI(`@postpostscript/sqlitePublic`) }, }, }) console.log(await Statement` SELECT * FROM "some-endpoint/someTable" JOIN "~/sqliteVals/vals" JOIN authIdExampleComments_comment LIMIT 1 `.execute({ sqlite })) Output: [ { someField: "some-field", id: "aeb70bbb-05fc-403b-8d6a-130c423ecb53", name: "discordWelcomedMembers", code: "// set at Sun Mar 10 2024 00:32:48 GMT+0000 (Coordinated Universal Time)\n" + "export let discordWelcomedM"... 8289 more characters, version: 234771, privacy: "public", public: 1, run_start_at: "2024-03-10T00:32:48.978Z", run_end_at: "2024-03-10T00:32:48.978Z", created_at: "2024-03-10T00:32:48.978Z", author_id: "a0bf3b31-15a5-4d5c-880e-4b1e22c9bc18", author_username: "stevekrouse", username: "postpostscript", comment: "test", date_added: 1709776325.857 } ] Part 2 Since Val Town currently has a character limit for val readmes, this will have to continue in Part 2 !
vladimyr avatar
valshot
@vladimyr
HTTP (deprecated)
Val Shot Generate val source code screenshot using sourcecodeshots.com ⚠️ This service is offered for personal use under a reasonable usage policy as stated here: https://sourcecodeshots.com/docs 📣 Special thanks to @pomdtr for their help and contributions! Usage https://vladimyr-valshot.web.val.run/v/<author>/<val> Example https://vladimyr-valshot.web.val.run/v/vladimyr/valshot https://vladimyr-valshot.web.val.run/v/pomdtr/readme
postpostscript avatar
blog
@postpostscript
HTTP (deprecated)
@postpostscript 's Val Town Blog Blog Posts: Ideas 2024-03-06 - Auth for Val Town 2024-03-09 - sqliteUniverse: Make SQLite Queries Against Multiple Endpoints in Deno (Val Town) (Part 1) 2024-03-09 - sqliteUniverse: Make SQLite Queries Against Multiple Endpoints in Deno (Val Town) (Part 2) Other Projects: 2024-02-25 - moduleHighlightValueLink: Link to a Val With a Value or Method's Code Highlighted 2024-02-28 - provideBlob: Return Response Quickly and Poll for the Expensive Parts 2024-03-02 - MyFooter: my footer component which shares random vals I've liked! 2024-03-16 - readmeManager: Edit Val Readmes With Persistent Drafts 2024-04-09 - reactiveStateBlob: wrap blob state in a proxy to autosave it on changes 2024-04-24 - lock: lock that releases when it leaves the execution context 2024-04-25 - fetchWorker: communicate with a worker over a fetch-like interface
xkonti avatar
gptMemoryManager
@xkonti
Script
A simple Rest API that allows for you GPT to save and recall snippets of data (memories). You can read my blog post explaining it in detail here: xkonti.tech Demonstration First conversation: What GPT sent do the API: { "name": "Life Essence and Biological Processes", "description": "Explore the role of life essence in enabling biological processes, with a focus on how dimensional interference, particularly from the Incorporeal dimension, facilitates the existence of these processes. This exploration should delve into the complex interplay between the Physical and Incorporeal dimensions, examining how life essence acts as a crucial element in the emergence and sustenance of life in the Physical dimension.", "summary": "Expanding on the role of life essence in biological processes, emphasizing the interaction between the Physical and Incorporeal dimensions.", "reason": "To deepen the understanding of how life essence, influenced by dimensional interference, is essential for biological processes in the novel's universe." } Separate conversation somewhere in the future: Setup There are several steps to set up the API: deploy and configure the API create the API key for your GPT add an action for the API in you GPT add prompt section to your GPT so that it can use it properly Deploying the API on Val Town Deploy your own memory API. You can fork the following Val to do it: https://www.val.town/v/xkonti/memoryApiExample In the code configure the appropriate values: apiName the name of your API - used in the Privacy Policy (eg. Memory API ) contactEmail - the email to provide for contact in the Privacy Policy (eg. some@email.com ) lastPolicyUpdate - the date the Privacy Policy was last updated (eg. 2023-11-28 ) blobKeyPrefix - the prefix for the blob storage keys used by your API - more info below (eg. gpt:memories: ) apiKeyPrefix - the prefix for you API Keys secrets - more info below (eg. GPTMEMORYAPI_KEY_ ) Create API keys The Memory API is designed to serve multiple GPTs at the same time. Each GPT should have it's own unique name and API key . The name is used for identifying the specific GPT and appended to both: blobKeyPrefix - to maintain separate memory storage from other GPTs apiKeyPrefix - to maintain separate API key for each GPT Please pick a unique alphanumeric name for your GPT. For example personaltrainer . Generate some alphanumeric API key for your GPT. For example Wrangle-Chapped-Monkhood4-Domain-Suspend Add a new secret to your Val.town secrets storage. The Key should be the picked name prefixed by apiKeyPrefix . Using the default it would be GPTMEMORYAPI_KEY_personaltrainer . The value of the secret should be the API key itself. The memories of the GPT will be stored in the blob storage under the key blobKeyPrefix + name , for example: gpt:memories:personaltrainer . Adding GPT action Add a new action in your GPT. Get the OpenAPI spefication by calling the /openapi endpoint of your API Change all <APIURL> instances within the specification to the url of your deployed API. For example https://xkonti-memoryapiexample.web.val.run Set the authentication method to basic and provide a base64 encoded version of the <name>:<apiKey> . For example: personaltrainer:Wrangle-Chapped-Monkhood4-Domain-Suspend -> cGVyc29uYWx0cmFpbmVyOldyYW5nbGUtQ2hhcHBlZC1Nb25raG9vZDQtRG9tYWluLVN1c3BlbmQ= Add the link to the privacy policy, which is the /privacy endpoint of your API. For example: https://xkonti-memoryapiexample.web.val.run/privacy Adding the prompt section To make your GPT understand the usage of your new action you should include usage instruction in your prompt. Here's an example of such instructions section: # Long-term memory At some point the user might ask you to do something with "memory". Things like "remember", "save to memory", "forget", "update memory", etc. Please use corresponding actions to achieve those tasks. User might also ask you to perform some task with the context of your "memory" - in that case fetch all memories before proceeding with the task. The memories should be formed in a clear and purely informative language, void of unnecessary adjectives or decorative language forms. An exception to that rule might be a case when the language itself is the integral part of information (snippet of writing to remember for later, examples of some specific language forms, quotes, etc.). Structure of a memory: - name - a simple name of the memory to give it context at a glance - description - a detailed description of the thing that should be remembered. There is no length limit. - summary - a short summary of the memory. This should be formed in a way that will allow for ease of understanding which memories to retrieve in full detail just by reading the list of summaries. If there are some simple facts that have to be remembered and are the main point of the memory they should be included in the summary. The summary should also be written in a compressed way with all unnecessary words skipped if possible (more like a set of keywords or a Google Search input). - reason - the reason for the remembering - this should give extra information about the situation in which the memory was requested to be saved. The memory accessed through those actions is a long-term memory persistent between various conversations with the user. You can assume that there already are many memories available for retrieval. In some situations you might want to save some information to your memory for future recall. Do it in situations where you expect that some important details of the conversation might be lost and should be preserved. Analogously you can retrieve memories at any point if the task at hand suggests the need or there isn't much information about the subject in your knowledge base.
ingenieroariel avatar
untitled_limeHornet
@ingenieroariel
Script
// investigate how to load duckdb with spatial extensions in this context in order to load buildings from s3.
tmcw avatar
poll
@tmcw
Express
Quick poll https://tmcw-poll.express.val.run This val, along with a val called poll_results and a val called poll_options , lets you conduct a little poll using just Val Town! With the express API , this exposes a web interface in which people can click an option and vote. We make sure everyone only votes once by setting a cookie in their browser. This uses htmx to make the voting experience slick, Tailwind to style the UI, and htm to generate HTML for the pages. If you want to use this yourself, fork this val, the poll_results val, and the poll_options val, and customize the options list. You can delete the existing results as well to clear the data.
Next