Skip to content

Commit 1f63be7

Browse files
authored
Merge pull request #3365 from quadratichq/qa
QA Auth 13th - 2
2 parents fb8f5d4 + b05d000 commit 1f63be7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+725
-231
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"cellvalue",
2525
"chrono",
2626
"Cinstrument",
27+
"clickhouse",
2728
"clippy",
2829
"cmdk",
2930
"Cockroachdb",

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ edition = "2024"
1515
description = "Infinite data grid with Python, JavaScript, and SQL built-in"
1616
repository = "https://github.com/quadratichq/quadratic"
1717
license-file = "LICENSE"
18-
version = "0.16.3"
18+
version = "0.16.4"
1919

2020

2121
[profile.release]

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.16.3
1+
0.16.4

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quadratic",
3-
"version": "0.16.3",
3+
"version": "0.16.4",
44
"author": {
55
"name": "David Kircos",
66
"email": "david@quadratichq.com",

quadratic-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quadratic-api",
3-
"version": "0.16.3",
3+
"version": "0.16.4",
44
"description": "",
55
"main": "index.js",
66
"scripts": {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "QFeedback" ADD COLUMN "context" TEXT;

quadratic-api/prisma/schema.prisma

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ model FileInvite {
248248
model QFeedback {
249249
id Int @id @default(autoincrement())
250250
feedback String
251+
// Additional context about the feedback source
252+
// If it's null, that's in-app feedback (which was the first kind we used)
253+
context String?
251254
created_date DateTime @default(now())
252255
userId Int?
253256
user User? @relation(fields: [userId], references: [id])

quadratic-api/src/ai/helpers/modelRouter.helper.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ export const getModelKey = async (
3535

3636
const promptMessages = getPromptMessagesForAI(messages);
3737

38-
// if the last message is not a user prompt, use the last AI prompt message model key
39-
const lastPromptMessage = promptMessages[promptMessages.length - 1];
40-
if (lastPromptMessage.role !== 'user' || lastPromptMessage.contextType !== 'userPrompt') {
41-
return getLastAIPromptMessageModelKey(promptMessages) ?? DEFAULT_BACKUP_MODEL;
42-
}
43-
4438
// if the model is the default free model, check if the user prompt contains an image file
4539
if (!isQuadraticModel(modelKey) && !MODELS_CONFIGURATION[modelKey].imageSupport) {
4640
const hasImageFile = getUserPromptMessages(promptMessages).some((message) =>
@@ -55,6 +49,12 @@ export const getModelKey = async (
5549
return modelKey;
5650
}
5751

52+
// if the last message is not a user prompt, use the last AI prompt message model key
53+
const lastPromptMessage = promptMessages[promptMessages.length - 1];
54+
if (lastPromptMessage.role !== 'user' || lastPromptMessage.contextType !== 'userPrompt') {
55+
return getLastAIPromptMessageModelKey(promptMessages) ?? DEFAULT_BACKUP_MODEL;
56+
}
57+
5858
const userTextPrompt = lastPromptMessage.content
5959
.filter(isContentText)
6060
.map((content) => content.text)

quadratic-api/src/auth/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export type ByEmailUser = {
1919
user_id?: string;
2020
};
2121

22-
export const getUsers = async (users: UsersRequest[], skipMissing = false): Promise<Record<number, User>> => {
22+
export const getUsers = async (users: UsersRequest[]): Promise<Record<number, User>> => {
2323
switch (AUTH_TYPE) {
2424
case 'auth0':
25-
return await getUsersFromAuth0(users, skipMissing);
25+
return await getUsersFromAuth0(users);
2626
case 'ory':
2727
return await getUsersFromOry(users);
2828
default:

quadratic-api/src/auth/auth0.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const getAuth0 = () => {
5757
* }
5858
* }
5959
*/
60-
export const getUsersFromAuth0 = async (users: { id: number; auth0Id: string }[], skipMissing = false) => {
60+
export const getUsersFromAuth0 = async (users: { id: number; auth0Id: string }[]) => {
6161
// If we got nothing, we return an empty object
6262
if (users.length === 0) {
6363
return {};
@@ -115,10 +115,6 @@ export const getUsersFromAuth0 = async (users: { id: number; auth0Id: string }[]
115115
},
116116
});
117117

118-
if (skipMissing) {
119-
return;
120-
}
121-
122118
throw new Error('Failed to retrieve all user info from Auth0');
123119
}
124120

0 commit comments

Comments
 (0)