Skip to content

Commit

Permalink
Fix concat, remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Feb 14, 2024
1 parent fb1933d commit 5207722
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lint": "eslint --ext .ts --ext .js . --fix",
"shell": "node --no-warnings scripts/shell.mjs",
"shell:dev": "node --no-warnings scripts/shell.mjs --dev",
"concat": "node ./scripts/concat.ts",
"concat": "node ./scripts/concat.mjs",
"dev": "wrangler dev --log-level error & npm run shell:dev",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest",
"test:dev": "jest --watchAll",
Expand Down
8 changes: 4 additions & 4 deletions scripts/concat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs'
import path, { dirname } from 'path'
import { fileURLToPath } from 'url'

const instructions = 'The above code was taken from the Cojourney codebase at https://github.com/cojourneyai/cojourney. You are writing tests and documentation for the Cojourney codebase. Please use the above code as a reference. Tests should be written with Jest and Typescript. Do not use mocks or stubs. Keep it very simple and straightforward.'
const instructions = 'The above code was taken from the Cojourney codebase at https://github.com/lalalune/bgent. You are writing tests and documentation for the Cojourney codebase. Please use the above code as a reference. Tests should be written with Jest and Typescript. Do not use mocks or stubs. Keep it very simple and straightforward.'

// Patterns to ignore
const ignorePatterns = ['messageExamples.ts', 'goal', 'goals', 'utils', 'logger', 'index', 'data', 'constants', 'templates', 'worker']
Expand All @@ -12,7 +12,7 @@ const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

// The directory containing the TypeScript files
const directoryPath = path.join(__dirname, 'src')
const directoryPath = path.join(__dirname, '../src')

// The file to which all TypeScript content will be written
const outputFile = path.join(__dirname, 'concatenated-output.ts')
Expand All @@ -24,7 +24,7 @@ const shouldIgnore = (filePath) => {

// Function to recursively read through directories and concatenate .ts files
const readDirectory = (dirPath) => {
let concatenatedContent = '# START COJOURNEY CODEBASE'
let concatenatedContent = '# START MY CODEBASE'

fs.readdirSync(dirPath).forEach(file => {
const filePath = path.join(dirPath, file)
Expand Down Expand Up @@ -54,5 +54,5 @@ const readDirectory = (dirPath) => {
const concatenatedContent = readDirectory(directoryPath)

// Write the concatenated content to the output file
fs.writeFileSync(outputFile, concatenatedContent + '# END COJOURNEY CODEBASE\n\n' + instructions)
fs.writeFileSync(outputFile, concatenatedContent + '# END MY CODEBASE\n\n' + instructions)
console.log('TypeScript files have been concatenated into:', outputFile)
3 changes: 0 additions & 3 deletions src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export function formatMessageActors({ actors }: { actors: Actor[] }) {
return finalActorStrings;
}

/** get random conversation examples
* return an array of random conversation examples from the messageExamples array
*/
export const getRandomMessageExamples = (count: number) => {
const examples: Array<
Array<
Expand Down
28 changes: 0 additions & 28 deletions src/lib/relationships.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { type SupabaseClient } from "@supabase/supabase-js";
import { type UUID } from "crypto";
import { type Relationship } from "./types";

/** create a connection
* @todo This should only be allowable by the current user if they are connected to both userA and userB
*/
export async function createRelationship({
supabase,
userA,
Expand Down Expand Up @@ -67,31 +64,6 @@ export async function getRelationships({
return data as Relationship[];
}

/**
* custom function to query relationships by embedding
* pull all actors in scene and compare their embeddings to the user's rolodex to draw in relevant matches
* @todo Implement this function
* @param {object} options
* @param {object} options.supabase
* @param {string} options.userId
* @param {object} options.embedding
*/
// export async function searchRelationships({ supabase, userId, embedding }) {
// }

// export async function createProfileEmbedding({ supabase, agent, runtime }: { supabase: SupabaseClient, agent: Actor, runtime: BgentRuntime }) {
// if (runtime.debugMode) {
// console.log(`Creating profile embedding for ${agent.name}`);
// }
// const embedding = await runtime.embed(agent.description);
// const { data, error } = await supabase.from("accounts").update({ profile_embedding: embedding }).eq("id", agent.id);
// if (error) {
// throw new Error(error.message);
// }

// return data;
// }

export async function formatRelationships({
supabase,
userId,
Expand Down
8 changes: 0 additions & 8 deletions src/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ export interface AgentRuntimeOpts {
evaluators?: Evaluator[]; // Optional custom evaluators
}

/**
* @class BgentRuntime
* @param {object} opts
* @param {number} opts.recentMessageCount
* @param {string} opts.token - JWT token
* @param {object} opts.supabase - Supabase client
* @param {boolean} opts.debugMode - If true, will log debug messages
*/
export class BgentRuntime {
readonly #recentMessageCount = 32 as number;
serverUrl = "http://localhost:7998";
Expand Down

0 comments on commit 5207722

Please sign in to comment.