Skip to content

Commit 42d94e5

Browse files
Frontend and LLM updates
1 parent f38caff commit 42d94e5

10 files changed

Lines changed: 72 additions & 59 deletions

File tree

frontend/src/app/modules/profile/account/account.component.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { MatInputModule } from '@angular/material/input';
88
import { MatSelectModule } from '@angular/material/select';
99
import { MatSnackBar } from '@angular/material/snack-bar';
1010
import { UserProfile, UserProfileUpdate } from '#shared/user/user.model';
11-
import { ApiListState } from '../../../core/api-state.types';
12-
import { UserService } from '../../../core/user/user.service';
13-
import { LlmService } from '../../llm.service';
11+
import { ApiListState } from '#core/api-state.types';
12+
import { UserService } from '#core/user/user.service';
13+
import { LlmService } from '#modules/llm.service';
1414
import { LlmInfo } from '#shared/llm/llm.model';
1515

1616
@Component({
@@ -23,6 +23,8 @@ import { LlmInfo } from '#shared/llm/llm.model';
2323
})
2424
export class SettingsAccountComponent implements OnInit {
2525
private readonly destroyRef = inject(DestroyRef);
26+
private userService = inject(UserService);
27+
private llmService = inject(LlmService);
2628

2729
accountForm!: FormGroup;
2830

@@ -31,11 +33,7 @@ export class SettingsAccountComponent implements OnInit {
3133
// Expose UserProfile signal for the template (for view-only email)
3234
readonly userProfile: Signal<UserProfile> = this.userService.userProfile;
3335

34-
constructor(
35-
private snackBar: MatSnackBar,
36-
private llmService: LlmService,
37-
private userService: UserService,
38-
) {
36+
constructor(private snackBar: MatSnackBar) {
3937
// Effect to react to user profile changes and patch the form
4038
effect(() => {
4139
const user = this.userService.userProfile();

frontend/tsconfig.app.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"compilerOptions": {
55
"outDir": "./out-tsc/app",
66
"types": [],
7-
"paths": {
8-
"#shared/*": ["../../shared/*"]
9-
}
107
},
118
"files": ["src/main.ts"],
129
"include": ["src/**/*.d.ts", "../../shared/**/*.ts"]

frontend/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"useDefineForClassFields": false,
1717
"lib": ["ES2022", "dom"],
1818
"paths": {
19-
"#core/*": ["./src/app/core/*"],
20-
"#environments/*": ["./src/environments/*"],
21-
"#modules/*": ["./src/app/modules/*"],
19+
"#core/*": ["./app/core/*"],
20+
"#environments/*": ["./environments/*"],
21+
"#modules/*": ["./app/modules/*"],
2222
"#shared/*": ["../../shared/*"]
2323
}
2424
},

frontend/tsconfig.spec.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"compilerOptions": {
55
"outDir": "./out-tsc/spec",
66
"types": ["jasmine"],
7-
"paths": {
8-
"#shared/*": ["../../shared/*"]
9-
}
107
},
118
"include": ["src/**/*.spec.ts", "src/**/*.d.ts", "../../shared/**/*.ts"]
129
}

package-lock.json

Lines changed: 47 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
"@ai-sdk/cerebras": "^0.2.14",
7171
"@ai-sdk/deepinfra": "^0.2.15",
7272
"@ai-sdk/deepseek": "^0.2.14",
73-
"@ai-sdk/google": "^1.2.17",
74-
"@ai-sdk/google-vertex": "^2.2.22",
73+
"@ai-sdk/google": "^1.2.19",
74+
"@ai-sdk/google-vertex": "^2.2.24",
7575
"@ai-sdk/groq": "^1.2.9",
7676
"@ai-sdk/openai": "^1.3.22",
7777
"@ai-sdk/perplexity": "^1.1.9",
@@ -99,8 +99,8 @@
9999
"@grpc/grpc-js": "^1.12.6",
100100
"@microsoft/tiktokenizer": "^1.0.8",
101101
"@mistralai/mistralai": "^1.7.1",
102-
"@modelcontextprotocol/sdk": "^1.11.4",
103-
"@mozilla/readability": "^0.5.0",
102+
"@modelcontextprotocol/sdk": "^1.13.2",
103+
"@mozilla/readability": "^0.6.0",
104104
"@octokit/request": "^5.1.0",
105105
"@openrouter/ai-sdk-provider": "^0.4.5",
106106
"@opentelemetry/api": "^1.6.0",

src/llm/services/ai-llm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export abstract class AiLLM<Provider extends ProviderV1> extends BaseLLM {
227227
// Streaming is required when max_tokens is greater than 21,333
228228
}
229229
// https://cloud.google.com/vertex-ai/generative-ai/docs/thinking#budget
230-
else if (this.getId().includes('gemini-2.5-flash')) {
230+
else if (this.getId().includes('gemini-2.5')) {
231231
if (combinedOpts.thinking === 'low') thinkingBudget = 8192;
232232
else if (combinedOpts.thinking === 'medium') thinkingBudget = 16384;
233233
else if (combinedOpts.thinking === 'high') thinkingBudget = 24576;

src/llm/services/anthropic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export const ANTHROPIC_SERVICE = 'anthropic';
1111
export function anthropicLLMRegistry(): Record<string, () => LLM> {
1212
return {
1313
[`${ANTHROPIC_SERVICE}:claude-3-5-haiku`]: Claude3_5_Haiku,
14-
[`${ANTHROPIC_SERVICE}:claude-4-sonnet`]: anthropicClaude4_Sonnet,
15-
[`${ANTHROPIC_SERVICE}:claude-4-opus`]: anthropicClaude4_Opus,
14+
[`${ANTHROPIC_SERVICE}:claude-sonnet-4`]: anthropicClaude4_Sonnet,
15+
[`${ANTHROPIC_SERVICE}:claude-opus-4`]: anthropicClaude4_Opus,
1616
};
1717
}
1818

src/llm/tokens.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ let tokenizer: TikTokenizer | null = null;
55
let loadingTokenizer: Promise<any> | null = null;
66

77
export function countTokensSync(text: string): number {
8-
if (!tokenizer) return 0;
8+
if (!tokenizer) {
9+
logger.warn('Tokenizer not initialized');
10+
countTokens('').catch((e) => console.error(e));
11+
return 0;
12+
}
913
return tokenizer.encode(text).length;
1014
}
1115

src/routes/chat/chat-routes.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function chatRoutes(fastify: AppFastifyInstance) {
3232
const userId = currentUser().id;
3333
const chat: Chat = await fastify.chatService.loadChat(chatId);
3434
if (chat.userId !== userId) return sendBadRequest(reply, 'Unauthorized to view this chat');
35-
console.log(JSON.stringify(chat));
35+
// console.log(JSON.stringify(chat));
3636
reply.sendJSON(chat);
3737
},
3838
);
@@ -219,9 +219,7 @@ export async function chatRoutes(fastify: AppFastifyInstance) {
219219
const userId = currentUser().id;
220220

221221
const chat: Chat = await fastify.chatService.loadChat(chatId);
222-
if (chat.userId !== userId) {
223-
return sendBadRequest(reply, 'Unauthorized to regenerate this chat');
224-
}
222+
if (chat.userId !== userId) return sendBadRequest(reply, 'Unauthorized to regenerate this chat');
225223

226224
let llm: LLM;
227225
try {
@@ -271,9 +269,8 @@ export async function chatRoutes(fastify: AppFastifyInstance) {
271269
const userId = currentUser().id;
272270
try {
273271
const chat = await fastify.chatService.loadChat(chatId);
274-
if (chat.userId !== userId) {
275-
return sendBadRequest(reply, 'Unauthorized to delete this chat');
276-
}
272+
if (chat.userId !== userId) return sendBadRequest(reply, 'Unauthorized to delete this chat');
273+
277274
await fastify.chatService.deleteChat(chatId);
278275
reply.code(204).send(); // 204 No Content, no body, so no sendJSON
279276
} catch (error) {

0 commit comments

Comments
 (0)