createInteractionForm.tsx1 match
7}
89export default function InteractionForm({ onSubmit }: InteractionFormProps) {
10const [formData, setFormData] = useState<Omit<Interaction, 'contact_id'>>({
11type: 'call' as InteractionType,
createContactDetail.tsx1 match
11}
1213export default function ContactDetail({
14contact,
15onEdit,
createContactForm.tsx1 match
8}
910export default function ContactForm({ contact, onSubmit }: ContactFormProps) {
11const [formData, setFormData] = useState<Contact>({
12id: contact?.id,
createContactList.tsx1 match
9}
1011export default function ContactList({
12contacts,
13selectedContactId,
6import ContactForm from "./ContactForm.tsx";
78export default function App() {
9const [contacts, setContacts] = useState<Contact[]>([]);
10const [selectedContact, setSelectedContact] = useState<Contact | null>(null);
createqueries.ts9 matches
45// Contact queries
6export async function getAllContacts(): Promise<Contact[]> {
7const result = await sqlite.execute(`SELECT * FROM ${CONTACTS_TABLE} ORDER BY name ASC`);
8return result.rows as Contact[];
9}
1011export async function getContactById(id: number): Promise<Contact | null> {
12const result = await sqlite.execute(
13`SELECT * FROM ${CONTACTS_TABLE} WHERE id = ?`,
17}
1819export async function createContact(contact: Contact): Promise<number> {
20const { name, email, phone, company, notes } = contact;
21const result = await sqlite.execute(
27}
2829export async function updateContact(id: number, contact: Contact): Promise<boolean> {
30const { name, email, phone, company, notes } = contact;
31const result = await sqlite.execute(
38}
3940export async function deleteContact(id: number): Promise<boolean> {
41const result = await sqlite.execute(
42`DELETE FROM ${CONTACTS_TABLE} WHERE id = ?`,
46}
4748export async function searchContacts(query: string): Promise<Contact[]> {
49const searchTerm = `%${query}%`;
50const result = await sqlite.execute(
5859// Interaction queries
60export async function getInteractionsByContactId(contactId: number): Promise<Interaction[]> {
61const result = await sqlite.execute(
62`SELECT * FROM ${INTERACTIONS_TABLE}
68}
6970export async function createInteraction(interaction: Interaction): Promise<number> {
71const { contact_id, type, notes, date } = interaction;
72const result = await sqlite.execute(
78}
7980export async function deleteInteraction(id: number): Promise<boolean> {
81const result = await sqlite.execute(
82`DELETE FROM ${INTERACTIONS_TABLE} WHERE id = ?`,
createmigrations.ts1 match
5export const INTERACTIONS_TABLE = 'personal_crm_interactions';
67export async function runMigrations() {
8// Create contacts table
9await sqlite.execute(`
16โ โโโ database/
17โ โ โโโ migrations.ts # Schema definitions
18โ โ โโโ queries.ts # DB query functions
19โ โโโ routes/ # Route modules
20โ โ โโโ api.ts # API endpoints
PRChecker2index.tsx2 matches
2import { useState } from "https://esm.sh/react@18.2.0";
34export default function GitHubPRAnalyzer() {
5const [prUrl, setPrUrl] = useState("");
6const [analysis, setAnalysis] = useState<any>(null);
7const [loading, setLoading] = useState(false);
89async function analyzeGitHubPR() {
10setLoading(true);
11try {
untitled-2444processor.ts10 matches
19* Process large text by splitting into chunks and sending to OpenAI
20*/
21export async function processLargeText(
22text: string,
23instructions: string,
102* Create a prompt based on script type
103*/
104function createPromptForScriptType(
105chunk: string,
106instructions: string,
204* Enhance instructions based on script type
205*/
206function enhanceInstructions(instructions: string, scriptType: string): string {
207// If instructions already seem comprehensive, return as is
208if (instructions.length > 100) {
235* Generate a unique session ID
236*/
237function generateSessionId(): string {
238return `script_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
239}
242* Save processing session data
243*/
244async function saveProcessingSession(sessionId: string, data: any): Promise<void> {
245await blob.setJSON(`sessions/${sessionId}`, data);
246}
249* Update processing progress
250*/
251async function updateProcessingProgress(sessionId: string, currentChunk: number, totalChunks: number): Promise<void> {
252const session = await blob.getJSON(`sessions/${sessionId}`);
253if (session) {
265* Save processing result
266*/
267async function saveProcessingResult(sessionId: string, result: string): Promise<void> {
268const session = await blob.getJSON(`sessions/${sessionId}`);
269if (session) {
289* Process a single chunk with OpenAI
290*/
291async function processChunkWithOpenAI(
292chunk: string,
293instructions: string,
338* Combine processed chunks into a single text with improved handling
339*/
340function combineProcessedChunks(chunks: string[]): string {
341if (chunks.length === 1) {
342return chunks[0];
367* Find the optimal overlap size between two text chunks
368*/
369function findOptimalOverlapSize(end: string, start: string): number {
370// Look for the largest common substring at the end of the first chunk
371// and the beginning of the second chunk