Skip to content

Commit 06dd0d5

Browse files
author
Addison.Rogers
committed
update: integrate @ai-sdk/react into ChatPage, refactor message handling logic, redesign chat UI, and update dependencies in pnpm-lock.yaml
1 parent 321bd8f commit 06dd0d5

File tree

15 files changed

+578
-81
lines changed

15 files changed

+578
-81
lines changed

.config/kysely.config.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {
2+
DummyDriver,
3+
PostgresAdapter,
4+
PostgresIntrospector,
5+
PostgresQueryCompiler,
6+
} from 'kysely'
7+
import {defineConfig} from 'kysely-ctl'
8+
import {MssqlDialect} from "kysely";
9+
import * as Tarn from "tarn";
10+
import * as Tedious from "tedious";
11+
12+
export default defineConfig({
13+
// replace me with a real dialect instance OR a dialect name + `dialectConfig` prop.
14+
dialect: new MssqlDialect({
15+
tarn: {
16+
...Tarn,
17+
options: {
18+
min: 0,
19+
max: 10,
20+
},
21+
},
22+
tedious: {
23+
...Tedious,
24+
connectionFactory: () => new Tedious.Connection({
25+
authentication: {
26+
type: 'azure-active-directory-default',
27+
},
28+
options: {
29+
database: process.env.AZSQL_DB as string,
30+
port: Number(process.env.AZSQL_PORT as string),
31+
trustServerCertificate: true,
32+
},
33+
server: process.env.AZSQL_SERVER as string,
34+
}),
35+
},
36+
}),
37+
migrations: {
38+
migrationFolder: "migrations",
39+
},
40+
// plugins: [],
41+
// seeds: {
42+
// seedFolder: "seeds",
43+
// }
44+
})

docs/Technical Design/Graph View.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Website --> OurUpdateQueue
1111
OurUpdateQueue --> OurSkillsTable
1212
Website <--> OpenAI
1313
14+
Opshub --> FunctionAPP
15+
FunctionAPP --> AzSQL
16+
1417
```
1518

1619

migrations/1751971100123_init.ts

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
import { Kysely, sql } from 'kysely'
2+
3+
export async function up(db: Kysely<any>): Promise<void> {
4+
// User Table
5+
await db.schema
6+
.createTable('user')
7+
.addColumn('id', 'varchar(255)', (col) => col.primaryKey())
8+
.addColumn('name', 'text', (col) => col.notNull())
9+
.addColumn('email', 'text', (col) => col.notNull().unique())
10+
.addColumn('email_verified', 'boolean', (col) => col.notNull())
11+
.addColumn('image', 'text')
12+
.addColumn('created_at', 'timestamp', (col) =>
13+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
14+
)
15+
.addColumn('updated_at', 'timestamp', (col) =>
16+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
17+
)
18+
.execute()
19+
20+
// Session Table
21+
await db.schema
22+
.createTable('session')
23+
.addColumn('id', 'varchar(255)', (col) => col.primaryKey())
24+
.addColumn('expires_at', 'timestamp', (col) => col.notNull())
25+
.addColumn('token', 'text', (col) => col.notNull().unique())
26+
.addColumn('created_at', 'timestamp', (col) =>
27+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
28+
)
29+
.addColumn('updated_at', 'timestamp', (col) =>
30+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
31+
)
32+
.addColumn('ip_address', 'text')
33+
.addColumn('user_agent', 'text')
34+
.addColumn('user_id', 'varchar(255)', (col) =>
35+
col.references('user.id').onDelete('cascade').notNull()
36+
)
37+
.execute()
38+
39+
// Account Table
40+
await db.schema
41+
.createTable('account')
42+
.addColumn('id', 'varchar(255)', (col) => col.primaryKey())
43+
.addColumn('account_id', 'text', (col) => col.notNull())
44+
.addColumn('provider_id', 'text', (col) => col.notNull())
45+
.addColumn('user_id', 'varchar(255)', (col) =>
46+
col.references('user.id').onDelete('cascade').notNull()
47+
)
48+
.addColumn('access_token', 'text')
49+
.addColumn('refresh_token', 'text')
50+
.addColumn('id_token', 'text')
51+
.addColumn('access_token_expires_at', 'timestamp')
52+
.addColumn('refresh_token_expires_at', 'timestamp')
53+
.addColumn('scope', 'text')
54+
.addColumn('password', 'text')
55+
.addColumn('created_at', 'timestamp', (col) =>
56+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
57+
)
58+
.addColumn('updated_at', 'timestamp', (col) =>
59+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
60+
)
61+
.execute()
62+
63+
// Verification Table
64+
await db.schema
65+
.createTable('verification')
66+
.addColumn('id', 'varchar(255)', (col) => col.primaryKey())
67+
.addColumn('identifier', 'text', (col) => col.notNull())
68+
.addColumn('value', 'text', (col) => col.notNull())
69+
.addColumn('expires_at', 'timestamp', (col) => col.notNull())
70+
.addColumn('created_at', 'timestamp')
71+
.addColumn('updated_at', 'timestamp')
72+
.execute()
73+
74+
// Skill Table
75+
await db.schema
76+
.createTable('skill')
77+
.addColumn('id', 'serial', (col) => col.primaryKey())
78+
.addColumn('name', 'text', (col) => col.notNull().unique())
79+
.addColumn('description', 'text')
80+
.addColumn('created_at', 'timestamp', (col) =>
81+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
82+
)
83+
.addColumn('updated_at', 'timestamp', (col) =>
84+
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
85+
)
86+
.execute()
87+
88+
// UserSkill Table
89+
await db.schema
90+
.createTable('user_skill')
91+
.addColumn('id', 'serial', (col) => col.primaryKey())
92+
.addColumn('user_id', 'varchar(255)', (col) =>
93+
col.references('user.id').onDelete('cascade').notNull()
94+
)
95+
.addColumn('skill_id', 'integer', (col) =>
96+
col.references('skill.id').onDelete('cascade').notNull()
97+
)
98+
.addColumn('acquired_at', 'timestamp')
99+
.addColumn('level', 'integer')
100+
.execute()
101+
102+
// Certification Table
103+
await db.schema
104+
.createTable('certification')
105+
.addColumn('id', 'serial', (col) => col.primaryKey())
106+
.addColumn('name', 'text', (col) => col.notNull())
107+
.addColumn('issuer', 'text')
108+
.execute()
109+
110+
// UserCertification Table
111+
await db.schema
112+
.createTable('user_certification')
113+
.addColumn('id', 'serial', (col) => col.primaryKey())
114+
.addColumn('user_id', 'varchar(255)', (col) =>
115+
col.references('user.id').onDelete('cascade').notNull()
116+
)
117+
.addColumn('cert_id', 'integer', (col) =>
118+
col.references('certification.id').onDelete('cascade').notNull()
119+
)
120+
.addColumn('issued_at', 'timestamp')
121+
.addColumn('expires_at', 'timestamp')
122+
.execute()
123+
124+
// Role Table
125+
await db.schema
126+
.createTable('role')
127+
.addColumn('id', 'serial', (col) => col.primaryKey())
128+
.addColumn('name', 'text', (col) => col.notNull())
129+
.addColumn('description', 'text')
130+
.execute()
131+
132+
// Client Table
133+
await db.schema
134+
.createTable('client')
135+
.addColumn('id', 'serial', (col) => col.primaryKey())
136+
.addColumn('name', 'text', (col) => col.notNull())
137+
.addColumn('description', 'text')
138+
.execute()
139+
140+
// Project Table
141+
await db.schema
142+
.createTable('project')
143+
.addColumn('id', 'serial', (col) => col.primaryKey())
144+
.addColumn('name', 'text', (col) => col.notNull())
145+
.addColumn('description', 'text')
146+
.addColumn('started_at', 'timestamp')
147+
.addColumn('ended_at', 'timestamp')
148+
.execute()
149+
150+
// ClientProject Table
151+
await db.schema
152+
.createTable('client_project')
153+
.addColumn('id', 'serial', (col) => col.primaryKey())
154+
.addColumn('client_id', 'integer', (col) =>
155+
col.references('client.id').onDelete('cascade').notNull()
156+
)
157+
.addColumn('project_id', 'integer', (col) =>
158+
col.references('project.id').onDelete('cascade').notNull()
159+
)
160+
.execute()
161+
162+
// ProjectUser Table
163+
await db.schema
164+
.createTable('project_user')
165+
.addColumn('id', 'serial', (col) => col.primaryKey())
166+
.addColumn('project_id', 'integer', (col) =>
167+
col.references('project.id').onDelete('cascade').notNull()
168+
)
169+
.addColumn('user_id', 'varchar(255)', (col) =>
170+
col.references('user.id').onDelete('cascade').notNull()
171+
)
172+
.addColumn('role_id', 'integer', (col) =>
173+
col.references('role.id').onDelete('cascade').notNull()
174+
)
175+
.execute()
176+
}
177+
178+
export async function down(db: Kysely<any>): Promise<void> {
179+
await db.schema.dropTable('project_user').execute()
180+
await db.schema.dropTable('client_project').execute()
181+
await db.schema.dropTable('project').execute()
182+
await db.schema.dropTable('client').execute()
183+
await db.schema.dropTable('role').execute()
184+
await db.schema.dropTable('user_certification').execute()
185+
await db.schema.dropTable('certification').execute()
186+
await db.schema.dropTable('user_skill').execute()
187+
await db.schema.dropTable('skill').execute()
188+
await db.schema.dropTable('verification').execute()
189+
await db.schema.dropTable('account').execute()
190+
await db.schema.dropTable('session').execute()
191+
await db.schema.dropTable('user').execute()
192+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"vitest": "vitest"
1111
},
1212
"dependencies": {
13+
"@ai-sdk/react": "^1.2.12",
1314
"@radix-ui/react-collapsible": "^1.1.11",
1415
"@radix-ui/react-dialog": "^1.1.14",
1516
"@radix-ui/react-dropdown-menu": "^2.1.15",
@@ -49,6 +50,7 @@
4950
"eslint": "^9",
5051
"eslint-config-next": "15.3.4",
5152
"jsdom": "^26.1.0",
53+
"kysely-ctl": "^0.13.1",
5254
"tailwindcss": "^4",
5355
"typescript": "^5",
5456
"vite-tsconfig-paths": "^5.1.4",

0 commit comments

Comments
 (0)