add_to_notion_w_aimain.tsx17 matches
37function createPrompt(title, description, properties) {
38let prompt =
39"You are processing content into a database. Based on the title of the database, its properties, their types and options, and any existing descriptions, infer appropriate values for the fields:\n";
40prompt += `Database Title: ${title}\n`;
4142if (description) {
43prompt += `Database Description: ${description}\n\n`;
44} else {
45prompt += "\n";
111}
112113async function get_and_save_notion_db_processed_properties(databaseId)
114{
115const response = await notion.databases.retrieve({ database_id: databaseId });
116const db_id = response.id.replaceAll("-", "");
117const processed_properties = processProperties(response);
122}
123124async function get_notion_db_info(databaseId) {
125databaseId = databaseId.replaceAll("-", "");
126let db_info = null;
127try {
128db_info = await blob.getJSON(databaseId);
129if (!db_info) {
130throw new Error("db_info is null or undefined");
131}
132} catch (error) {
133db_info = await get_and_save_notion_db_processed_properties(databaseId);
134}
135db_info["zod_schema"] = createZodSchema(db_info["filteredProps"]);
137}
138139async function get_and_save_notion_db_info(databaseId) {
140databaseId = databaseId.replaceAll("-", "");
141let db_info = await get_and_save_notion_db_processed_properties(databaseId);
142db_info["zod_schema"] = createZodSchema(db_info["filteredProps"]);
143return db_info;
283}
284285async function addToNotion(databaseId, text) {
286databaseId = databaseId.replaceAll("-", "");
287const properties = await process_text(databaseId, text);
288console.log(properties);
289const response = await notion.pages.create({
290"parent": {
291"type": "database_id",
292"database_id": databaseId,
293},
294"properties": properties,
add_to_notion_w_aiREADME.md4 matches
1Uses instructor and open ai (with gpt-4-turbo) to process any content into a notion database entry.
23Use `addToNotion` with any database id and content.
45```
10```
1112Prompts are created based on your database name, database description, property name, property type, property description, and if applicable, property options (and their descriptions).
1314Supports: checkbox, date, multi_select, number, rich_text, select, status, title, url, email
1516- Uses `NOTION_API_KEY`, `OPENAI_API_KEY` stored in env variables and uses [Valtown blob storage](https://esm.town/v/std/blob) to store information about the database.
17- Use `get_notion_db_info` to use the stored blob if exists or create one, use `get_and_save_notion_db_info` to create a new blob (and replace an existing one if exists).
18
connect4_sitemain.tsx1 match
1058// There are concurrency issues with this, turns could get
1059// evaluated twice and overwrite each other, but future steve
1060// can handle that with a real database.
1061app.post("/matches/:match_id/agent_turn", async (c) => {
1062const parsed_id = MatchId.safeParse(c.req.param("match_id"));
3Creates a global redis instance and exposes functions to use it.
45To use, create a redis database on [Upstash](https://upstash.com/) and set the environment variables.
6* `UPSTASH_REDIS_REST_URL`
7* `UPSTASH_REDIS_REST_TOKEN`
add_to_notion_from_todoistmain.tsx5 matches
20"papers": {
21"todoist-section-id": "SECTION_ID_HERE",
22"notion-map-type": "database",
23"notion-id": "DB_ID_HERE",
24},
102}
103104async function addPageToNotionDatabse(database_id, content) {
105const response = await notion.pages.create({
106"parent": {
107"type": "database_id",
108"database_id": database_id,
109},
110"properties": {
133addCalloutToNotionPage(mappedNotionId, task.content, convertDateObject(task.due));
134}
135else if (mappedNotionType == "database" && mappedNotionId) {
136addPageToNotionDatabse(mappedNotionId, task.content);
137}
1Use todoist for quick notes to add to notion. Uses project to decide which project to fetch to add stuff to notion. Can add to page or database based on config below. Demarkation using sections in the todoist project. Extracts date for page blocks that are added as callouts.
23Migrated from folder: Public/add_to_notion_from_todoist
89if (!NOTION_API_KEY || !PAPERPILE_DB_ID) {
10throw new Error("Please fill in your API key and database ID");
11}
12let dont_update = [];
14const notion = new Client({ auth: NOTION_API_KEY });
1516const databaseId = PAPERPILE_DB_ID;
1718const queryResponse = await notion.databases.query({
19database_id: databaseId,
20page_size: 100,
21filter: {
3536console.log(
37`Checked database, found ${relevant_results.length} items to update.`,
38);
39
dateMeNotionDatabasemain.tsx3 matches
1import { notionGetDatabase } from "https://esm.town/v/stevekrouse/notionGetDatabase";
2import process from "node:process";
34export let dateMeNotionDatabase = notionGetDatabase({
5databaseId: "725cb1d741674413b933a37a50f1961f",
6auth: process.env.notion,
7});
dateme_sqliteREADME.md2 matches
23```ts
4import { setupDatabase } from "https://esm.town/v/stevekrouse/dateme_sqlite"
56await setupDatabase()
7```
8