Skip to content

Commit 6e2aeef

Browse files
rename "partner" to "contact"
1 parent 9e41cb2 commit 6e2aeef

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ below), it will automatically use those files and start with HTTPS. Pretty cool.
112112
113113
## How It Works
114114
115-
WellSaid connects to your macOS Messages database to fetch your conversations with a specific contact (set via the `PARTNER_PHONE` environment variable). It then uses an AI provider (any combination of OpenAI, Anthropic, Grok, and/or Khoj) to analyze the conversation and generate:
115+
WellSaid connects to your macOS Messages database to fetch your conversations with a specific contact (set via the `CONTACT_PHONE` environment variable). It then uses an AI provider (any combination of OpenAI, Anthropic, Grok, and/or Khoj) to analyze the conversation and generate:
116116
117117
1. A summary of the conversation, including emotional tone and key topics
118118
1. Three suggested replies (short, medium, and long) in your chosen tone
@@ -210,10 +210,10 @@ Now when you visit your app over HTTPS (via Safari), iOS will trust the cert, an
210210
211211
### Common Issues
212212
213-
- **0 Messages Found**: Open the Messages app on your Mac and sign in if you haven't already. Summaries and replies will be available once you've signed in and your partner has sent at least one message.
214-
- **Messages Not Loading**: Ensure you've set the correct `PARTNER_PHONE` in your `.env` file.
213+
- **0 Messages Found**: Open the Messages app on your Mac and sign in if you haven't already. Summaries and replies will be available once you've signed in and your contact has sent at least one message.
214+
- **Messages Not Loading**: Ensure you've set the correct `CONTACT_PHONE` in your `.env` file.
215215
- **Permission Issues**: WellSaid needs access to your Messages database. Make sure Terminal/your editor has Full Disk Access in System Preferences > Security & Privacy.
216-
- **Go Button Disabled**: Conversation summaries are only available when your partner has responded in the selected time frame.
216+
- **Go Button Disabled**: Conversation summaries are only available when your contact has responded in the selected time frame.
217217

218218
## Acknowledgements
219219

src/lib/components/SettingsForm.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// Group settings by provider
3434
const settingsGroups = $derived({
3535
general: settings.filter((s: { key: string; value: string; description: string }) =>
36-
['HISTORY_LOOKBACK_HOURS', 'PARTNER_PHONE', 'CUSTOM_CONTEXT'].includes(s.key)
36+
['HISTORY_LOOKBACK_HOURS', 'CONTACT_PHONE', 'CUSTOM_CONTEXT'].includes(s.key)
3737
),
3838
khoj: settings.filter((s: { key: string; value: string; description: string }) =>
3939
s.key.startsWith('KHOJ_')
@@ -232,7 +232,7 @@
232232
}
233233
234234
/* Specific field widths */
235-
input[name='PARTNER_PHONE'] {
235+
input[name='CONTACT_PHONE'] {
236236
width: 200px;
237237
}
238238

tests/lib/history.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('fetchRelevantHistory', () => {
2020
it('returns empty string when no history found', async () => {
2121
vi.mocked(queryMessagesDb).mockResolvedValue({ messages: [] })
2222
const messages: Message[] = [
23-
{ sender: 'partner', text: 'hi', timestamp: '2025-05-20T10:00:00Z' },
23+
{ sender: 'contact', text: 'hi', timestamp: '2025-05-20T10:00:00Z' },
2424
]
2525
const result = await fetchRelevantHistory(messages)
2626
expect(result).toBe('')
@@ -31,18 +31,18 @@ describe('fetchRelevantHistory', () => {
3131
messages: [
3232
{ sender: 'me', text: 'old1', timestamp: '2025-05-19T09:00:00Z' },
3333
{
34-
sender: 'partner',
34+
sender: 'contact',
3535
text: 'old2',
3636
timestamp: '2025-05-19T09:05:00Z',
3737
},
3838
],
3939
})
4040
const messages: Message[] = [
41-
{ sender: 'partner', text: 'hi', timestamp: '2025-05-20T10:00:00Z' },
41+
{ sender: 'contact', text: 'hi', timestamp: '2025-05-20T10:00:00Z' },
4242
]
4343
const result = await fetchRelevantHistory(messages)
4444
expect(result).toContain('me: old1')
45-
expect(result).toContain('partner: old2')
45+
expect(result).toContain('contact: old2')
4646
})
4747

4848
it('returns messages from the correct time range', async () => {
@@ -54,15 +54,15 @@ describe('fetchRelevantHistory', () => {
5454
vi.mocked(queryMessagesDb).mockResolvedValue({
5555
messages: [
5656
{ sender: 'me', text: 'older message', timestamp: '2025-05-20T09:30:00Z' },
57-
{ sender: 'partner', text: 'oldest message', timestamp: '2025-05-20T09:00:00Z' },
57+
{ sender: 'contact', text: 'oldest message', timestamp: '2025-05-20T09:00:00Z' },
5858
],
5959
})
6060

6161
const result = await fetchRelevantHistory(inputMessages)
6262

6363
// Should only contain messages older than the input
6464
expect(result).toContain('me: older message')
65-
expect(result).toContain('partner: oldest message')
65+
expect(result).toContain('contact: oldest message')
6666
expect(result).not.toContain('current message')
6767
})
6868
})

tests/lib/iMessages.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('queryMessagesDb', () => {
8484
expect(mockDb.close).toHaveBeenCalled()
8585
})
8686

87-
it('should return empty array when no partner messages exist', async () => {
87+
it('should return empty array when no contact messages exist', async () => {
8888
// Mock database response with only messages from me
8989
const mockDb = {
9090
all: vi.fn().mockResolvedValue([
@@ -112,9 +112,9 @@ describe('queryMessagesDb', () => {
112112
expect(result.messages).toEqual([])
113113
})
114114

115-
it('should return empty array when PARTNER_PHONE is not set', async () => {
115+
it('should return empty array when CONTACT_PHONE is not set', async () => {
116116
// Temporarily unset the environment variable for this test
117-
vi.stubEnv('PARTNER_PHONE', '')
117+
vi.stubEnv('CONTACT_PHONE', '')
118118

119119
const result = await queryMessagesDb('2025-05-23 12:01:00', '2025-05-23 12:02:00')
120120

@@ -123,7 +123,7 @@ describe('queryMessagesDb', () => {
123123

124124
// Restore the original value
125125
vi.unstubAllEnvs()
126-
vi.stubEnv('PARTNER_PHONE', '+1234567890')
126+
vi.stubEnv('CONTACT_PHONE', '+1234567890')
127127
})
128128

129129
// Now that we've added proper error handling, we can test this behavior

tests/lib/openAi.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ vi.mock('$lib/config', () => ({
1818
OPENAI_TOP_P: '0.7',
1919
OPENAI_FREQUENCY_PENALTY: '0.1',
2020
OPENAI_PRESENCE_PENALTY: '0.2',
21-
CUSTOM_CONTEXT: 'Act as my therapist suggesting replies to my partner',
21+
CUSTOM_CONTEXT: 'Act as my therapist suggesting replies to my contact',
2222
},
2323
}))
2424

@@ -29,7 +29,7 @@ vi.mock('$lib/history', () => ({
2929
describe('getOpenaiReply', () => {
3030
beforeEach(async () => {
3131
vi.clearAllMocks()
32-
;(await import('$lib/config')).settings.OPENAI_API_KEY = 'test-api-key'
32+
; (await import('$lib/config')).settings.OPENAI_API_KEY = 'test-api-key'
3333
// Mock the fetch function
3434
global.fetch = vi.fn().mockResolvedValue({
3535
ok: true,
@@ -43,7 +43,7 @@ describe('getOpenaiReply', () => {
4343
name: 'draft_replies',
4444
arguments: JSON.stringify({
4545
summary:
46-
"Here's a summary of the conversation. The conversation is about planning a weekend trip. Your partner seems excited about going hiking.",
46+
"Here's a summary of the conversation. The conversation is about planning a weekend trip. Your contact seems excited about going hiking.",
4747
replies: [
4848
"I'm excited about the hiking trip too! What trails are you thinking about?",
4949
'The hiking sounds fun! Should we plan to bring a picnic lunch?',
@@ -63,7 +63,7 @@ describe('getOpenaiReply', () => {
6363
it('should return summary and replies when API call is successful', async () => {
6464
const messages: Message[] = [
6565
{
66-
sender: 'partner',
66+
sender: 'contact',
6767
text: "Let's go hiking this weekend!",
6868
timestamp: '2025-05-23T12:00:00Z',
6969
},
@@ -108,7 +108,7 @@ describe('getOpenaiReply', () => {
108108

109109
const messages: Message[] = [
110110
{
111-
sender: 'partner',
111+
sender: 'contact',
112112
text: 'How are you today?',
113113
timestamp: '2025-05-23T12:00:00Z',
114114
},
@@ -122,11 +122,11 @@ describe('getOpenaiReply', () => {
122122

123123
it('should handle case when OPENAI_API_KEY is not set', async () => {
124124
// Mock the setting without the API key
125-
;(await import('$lib/config')).settings.OPENAI_API_KEY = ''
125+
; (await import('$lib/config')).settings.OPENAI_API_KEY = ''
126126

127127
const messages: Message[] = [
128128
{
129-
sender: 'partner',
129+
sender: 'contact',
130130
text: 'Hello!',
131131
timestamp: '2025-05-23T12:00:00Z',
132132
},
@@ -168,7 +168,7 @@ describe('getOpenaiReply', () => {
168168

169169
const messages: Message[] = [
170170
{
171-
sender: 'partner',
171+
sender: 'contact',
172172
text: 'Test message',
173173
timestamp: '2025-05-23T12:00:00Z',
174174
},
@@ -187,7 +187,7 @@ describe('getOpenaiReply', () => {
187187
it('includes optional parameters when environment variables are set', async () => {
188188
const messages: Message[] = [
189189
{
190-
sender: 'partner',
190+
sender: 'contact',
191191
text: 'Hello!',
192192
timestamp: '2025-05-23T12:00:00Z',
193193
},
@@ -206,15 +206,15 @@ describe('getOpenaiReply', () => {
206206
})
207207

208208
it('omits optional parameters when environment variables are empty', async () => {
209-
;(await import('$lib/config')).settings.OPENAI_TOP_P = ''
210-
;(await import('$lib/config')).settings.OPENAI_FREQUENCY_PENALTY = ''
211-
;(await import('$lib/config')).settings.OPENAI_PRESENCE_PENALTY = ''
209+
; (await import('$lib/config')).settings.OPENAI_TOP_P = ''
210+
; (await import('$lib/config')).settings.OPENAI_FREQUENCY_PENALTY = ''
211+
; (await import('$lib/config')).settings.OPENAI_PRESENCE_PENALTY = ''
212212
vi.resetModules()
213213
const { getOpenaiReply: getOpenaiReplyNoOpts } = await import('$lib/openAi')
214214

215215
const messages: Message[] = [
216216
{
217-
sender: 'partner',
217+
sender: 'contact',
218218
text: 'Hi',
219219
timestamp: '2025-05-23T12:00:00Z',
220220
},

tests/lib/prompts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe('prompts', () => {
102102
expect(result).toContain('Suggested replies:')
103103
// Check that there are no actual message lines (empty conversation)
104104
expect(result).not.toContain('\nme: ')
105-
expect(result).not.toContain('\npartner: ')
105+
expect(result).not.toContain('\ncontact: ')
106106
})
107107

108108
it('should handle single message conversation', () => {
@@ -117,7 +117,7 @@ describe('prompts', () => {
117117
expect(result).toContain('Reply 1:')
118118
expect(result).toContain('Reply 2:')
119119
expect(result).toContain('Reply 3:')
120-
expect(result).not.toContain('partner:')
120+
expect(result).not.toContain('contact:')
121121
})
122122

123123
it('should preserve message order and indexing', () => {

tests/routes/root/server.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import * as config from '$lib/config'
2+
import * as grok from '$lib/grok'
13
import * as queryDb from '$lib/iMessages'
24
import * as khoj from '$lib/khoj'
35
import * as openai from '$lib/openAi'
4-
import * as grok from '$lib/grok'
56
import * as registry from '$lib/providers/registry'
6-
import * as config from '$lib/config'
77
import type { RequestEvent } from '@sveltejs/kit'
88
import { beforeEach, describe, expect, it, vi } from 'vitest'
99
import * as serverModule from '../../../src/routes/+page.server'
@@ -80,14 +80,14 @@ describe('root page server', () => {
8080

8181
it('load should return messages and multiProvider flag', async () => {
8282
vi.mocked(queryDb.queryMessagesDb).mockResolvedValue({
83-
messages: [{ text: 'hi', sender: 'partner', timestamp: '2025-01-01T00:00:00Z' }],
83+
messages: [{ text: 'hi', sender: 'contact', timestamp: '2025-01-01T00:00:00Z' }],
8484
})
8585
const event = createMockRequestEvent(new URL('https://example.com/'))
8686
const data = await serverModule.load(
8787
event as unknown as Parameters<typeof serverModule.load>[0]
8888
)
8989
expect(data).toEqual({
90-
messages: [{ text: 'hi', sender: 'partner', timestamp: '2025-01-01T00:00:00Z' }],
90+
messages: [{ text: 'hi', sender: 'contact', timestamp: '2025-01-01T00:00:00Z' }],
9191
multiProvider: false,
9292
defaultProvider: 'openai',
9393
availableProviders: [

0 commit comments

Comments
 (0)