-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.ts
164 lines (147 loc) · 3.14 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import Stripe from "stripe"
export interface PageMeta {
title: string
description: string
cardImage: string
}
export interface Customer {
id: string /* primary key */
stripe_customer_id?: string
}
export interface Product {
id: string /* primary key */
active?: boolean
name?: string
description?: string
image?: string
metadata?: Stripe.Metadata
}
export interface ProductWithPrice extends Product {
prices?: Price[]
}
export interface UserDetails {
id: string /* primary key */
first_name: string
last_name: string
full_name?: string
avatar_url?: string
billing_address?: Stripe.Address
payment_method?: Stripe.PaymentMethod[Stripe.PaymentMethod.Type]
}
export interface Price {
id: string /* primary key */
product_id?: string /* foreign key to products.id */
active?: boolean
description?: string
unit_amount?: number
currency?: string
type?: Stripe.Price.Type
interval?: Stripe.Price.Recurring.Interval
interval_count?: number
trial_period_days?: number | null
metadata?: Stripe.Metadata
products?: Product
}
export interface PriceWithProduct extends Price {}
export interface Subscription {
id: string /* primary key */
user_id: string
status?: Stripe.Subscription.Status
metadata?: Stripe.Metadata
price_id?: string /* foreign key to prices.id */
quantity?: number
cancel_at_period_end?: boolean
created: string
current_period_start: string
current_period_end: string
ended_at?: string
cancel_at?: string
canceled_at?: string
trial_start?: string
trial_end?: string
prices?: Price
}
export type PGEssay = {
title: string
url: string
date: string
thanks: string
content: string
length: number
tokens: number
chunks: PGChunk[]
}
/**
* Content is a generic type for embedding
*/
export type Content = {
content: string
url?: string
date?: string
title?: string
mentions?: string[]
length: number
tokens: number
chunks: Chunk[] // TODO: refactor PGChunk to be more generic
avatar_id?: string
}
export type Chunk = {
content: string
content_length: number
content_tokens: number
original_url?: string
original_date?: string
embedding: number[]
}
export type PGChunk = {
essay_title: string // FIXME: dont need title
essay_url: string
essay_date: string
essay_thanks: string // FIXME: dont need thanks
content: string
content_length: number
content_tokens: number
embedding: number[]
}
export type PGJSON = {
current_date: string
author: string
url: string
length: number
tokens: number
essays: PGEssay[]
}
export type Avatar = {
id: string
username: string
name: string
avatar_url?: string
bio?: string
twitterUrl?: string
linkedinUrl?: string
status?: string
owner_id?: string
// optional
essaysCount?: number
repliesCount?: number
}
export type Message = {
id: string
from_id: string
to_id: string
content: string
created_at: string
}
export interface OpenAIMessage {
role: "user" | "system" | "assistant"
content: string
}
export type Memo = {
id: string
content: string
avatar_id: string
created_at: string
created_by: string
updated_at: string
embeddings?: string[]
}