Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fixes #2663: validate AI output for test connection endpoint (#2674)

Amruth Pillaida9a3c0b128a
diff --git a/locales/af-ZA.po b/locales/af-ZA.po
index 3dae798f2..a40fe2336 100644
Binary files a/locales/af-ZA.po and b/locales/af-ZA.po differ
diff --git a/locales/am-ET.po b/locales/am-ET.po
index d6fd0385a..aff4da525 100644
--- a/locales/am-ET.po
+++ b/locales/am-ET.po
@@ -2859,4 +2859,3 @@ msgstr "አጉር"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "ዙሉ"
-
diff --git a/locales/ar-SA.po b/locales/ar-SA.po
index 7e759c083..45c8cf4a1 100644
--- a/locales/ar-SA.po
+++ b/locales/ar-SA.po
@@ -2859,4 +2859,3 @@ msgstr "تصغير"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "الزولو"
-
diff --git a/locales/az-AZ.po b/locales/az-AZ.po
index 3f27dab04..506f3de80 100644
--- a/locales/az-AZ.po
+++ b/locales/az-AZ.po
@@ -2859,4 +2859,3 @@ msgstr "Uzaqlaşdır"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/bg-BG.po b/locales/bg-BG.po
index 9cad18290..206ae0e66 100644
--- a/locales/bg-BG.po
+++ b/locales/bg-BG.po
@@ -2859,4 +2859,3 @@ msgstr "Намаляване"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Зулуски"
-
diff --git a/locales/bn-BD.po b/locales/bn-BD.po
index f9fb1705c..63e6aaa78 100644
--- a/locales/bn-BD.po
+++ b/locales/bn-BD.po
@@ -2859,4 +2859,3 @@ msgstr "জুম আউট"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "জুলু"
-
diff --git a/locales/ca-ES.po b/locales/ca-ES.po
index 62c4c99d6..88e461916 100644
--- a/locales/ca-ES.po
+++ b/locales/ca-ES.po
@@ -2859,4 +2859,3 @@ msgstr "Allunya"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulú"
-
diff --git a/locales/cs-CZ.po b/locales/cs-CZ.po
index b958cfbf7..7b8f47432 100644
--- a/locales/cs-CZ.po
+++ b/locales/cs-CZ.po
@@ -2859,4 +2859,3 @@ msgstr "Oddálit"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/da-DK.po b/locales/da-DK.po
index a10380eb0..d9cb0e88f 100644
--- a/locales/da-DK.po
+++ b/locales/da-DK.po
@@ -2859,4 +2859,3 @@ msgstr "Zoom ud"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/de-DE.po b/locales/de-DE.po
index 24dc59e73..5c9cd5a62 100644
--- a/locales/de-DE.po
+++ b/locales/de-DE.po
@@ -2859,4 +2859,3 @@ msgstr "Herauszoomen"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/el-GR.po b/locales/el-GR.po
index c39c745d3..39796e983 100644
--- a/locales/el-GR.po
+++ b/locales/el-GR.po
@@ -2859,4 +2859,3 @@ msgstr "Σμίκρυνση"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Ζουλού"
-
diff --git a/locales/es-ES.po b/locales/es-ES.po
index b6de39bf1..6f74e0681 100644
--- a/locales/es-ES.po
+++ b/locales/es-ES.po
@@ -2859,4 +2859,3 @@ msgstr "Alejar"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulú"
-
diff --git a/locales/fa-IR.po b/locales/fa-IR.po
index e7983afc9..79b200d8c 100644
--- a/locales/fa-IR.po
+++ b/locales/fa-IR.po
@@ -2859,4 +2859,3 @@ msgstr "کوچک‌نمایی"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "زولو"
-
diff --git a/locales/fi-FI.po b/locales/fi-FI.po
index 0a453db2b..e17f04731 100644
--- a/locales/fi-FI.po
+++ b/locales/fi-FI.po
@@ -2859,4 +2859,3 @@ msgstr "Loitonna"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/fr-FR.po b/locales/fr-FR.po
index b1499af46..c4f20f510 100644
--- a/locales/fr-FR.po
+++ b/locales/fr-FR.po
@@ -2859,4 +2859,3 @@ msgstr "Zoom arrière"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zoulou"
-
diff --git a/locales/he-IL.po b/locales/he-IL.po
index 32f17c99a..e5996d5da 100644
--- a/locales/he-IL.po
+++ b/locales/he-IL.po
@@ -2859,4 +2859,3 @@ msgstr "התרחקות"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "זולו"
-
diff --git a/locales/hi-IN.po b/locales/hi-IN.po
index 5ea6c50b7..ec3bbfa92 100644
--- a/locales/hi-IN.po
+++ b/locales/hi-IN.po
@@ -2859,4 +2859,3 @@ msgstr "ज़ूम आउट"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "ज़ुलु"
-
diff --git a/locales/hu-HU.po b/locales/hu-HU.po
index a000174b0..3bfd56fce 100644
--- a/locales/hu-HU.po
+++ b/locales/hu-HU.po
@@ -2859,4 +2859,3 @@ msgstr "Kicsinyítés"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/id-ID.po b/locales/id-ID.po
index ff1a24246..831dac437 100644
--- a/locales/id-ID.po
+++ b/locales/id-ID.po
@@ -2859,4 +2859,3 @@ msgstr "Perkecil"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/it-IT.po b/locales/it-IT.po
index 24817c399..532008686 100644
--- a/locales/it-IT.po
+++ b/locales/it-IT.po
@@ -2859,4 +2859,3 @@ msgstr "Rimpicciolisci"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/ja-JP.po b/locales/ja-JP.po
index d3d103fc0..94b667cde 100644
--- a/locales/ja-JP.po
+++ b/locales/ja-JP.po
@@ -2859,4 +2859,3 @@ msgstr "ズームアウト"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "ズールー語"
-
diff --git a/locales/km-KH.po b/locales/km-KH.po
index 10dbc4051..0a2818f85 100644
--- a/locales/km-KH.po
+++ b/locales/km-KH.po
@@ -2859,4 +2859,3 @@ msgstr "បង្រួម"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/kn-IN.po b/locales/kn-IN.po
index ad20c6155..1e1475525 100644
--- a/locales/kn-IN.po
+++ b/locales/kn-IN.po
@@ -2859,4 +2859,3 @@ msgstr "ಗಾತ್ರ ಕುಗ್ಗಿಸಿ"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "ಜೂಲೂ"
-
diff --git a/locales/ko-KR.po b/locales/ko-KR.po
index 33350e466..f11151b20 100644
--- a/locales/ko-KR.po
+++ b/locales/ko-KR.po
@@ -2859,4 +2859,3 @@ msgstr "축소"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "줄루어"
-
diff --git a/locales/lt-LT.po b/locales/lt-LT.po
index d2fb82d51..f74225457 100644
--- a/locales/lt-LT.po
+++ b/locales/lt-LT.po
@@ -2859,4 +2859,3 @@ msgstr "Tolinti"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulų"
-
diff --git a/locales/lv-LV.po b/locales/lv-LV.po
index 81ffda1a5..e16c430d0 100644
--- a/locales/lv-LV.po
+++ b/locales/lv-LV.po
@@ -2859,4 +2859,3 @@ msgstr "Tālināt"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/ml-IN.po b/locales/ml-IN.po
index 5ace7da6e..30622c0c9 100644
--- a/locales/ml-IN.po
+++ b/locales/ml-IN.po
@@ -2859,4 +2859,3 @@ msgstr "സൂം ഔട്ട് ചെയ്യുക"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "സൂളു"
-
diff --git a/locales/mr-IN.po b/locales/mr-IN.po
index f47281721..6a1a1aaf2 100644
--- a/locales/mr-IN.po
+++ b/locales/mr-IN.po
@@ -2859,4 +2859,3 @@ msgstr "बाहेर झूम करा"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "झुलू"
-
diff --git a/locales/ms-MY.po b/locales/ms-MY.po
index 3d3c3db25..60316834b 100644
--- a/locales/ms-MY.po
+++ b/locales/ms-MY.po
@@ -2859,4 +2859,3 @@ msgstr "Zum keluar"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/ne-NP.po b/locales/ne-NP.po
index 0a2c97169..de2c61300 100644
--- a/locales/ne-NP.po
+++ b/locales/ne-NP.po
@@ -2859,4 +2859,3 @@ msgstr "जूम आउट"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "जुलु"
-
diff --git a/locales/nl-NL.po b/locales/nl-NL.po
index c2cae015d..bcdb776ed 100644
--- a/locales/nl-NL.po
+++ b/locales/nl-NL.po
@@ -2859,4 +2859,3 @@ msgstr "Uitzoomen"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/no-NO.po b/locales/no-NO.po
index b9547af44..53daf3088 100644
--- a/locales/no-NO.po
+++ b/locales/no-NO.po
@@ -2859,4 +2859,3 @@ msgstr "Zoom ut"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/or-IN.po b/locales/or-IN.po
index dcb689efd..ac24bf1c2 100644
--- a/locales/or-IN.po
+++ b/locales/or-IN.po
@@ -2859,4 +2859,3 @@ msgstr "ଜୁମ୍ ଆଉଟ୍ କରନ୍ତୁ"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "ଜୁଲୁ"
-
diff --git a/locales/pl-PL.po b/locales/pl-PL.po
index 434c19485..2a7f45285 100644
--- a/locales/pl-PL.po
+++ b/locales/pl-PL.po
@@ -2859,4 +2859,3 @@ msgstr "Pomniejsz"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/pt-BR.po b/locales/pt-BR.po
index 2390ebd86..0a3867ec5 100644
--- a/locales/pt-BR.po
+++ b/locales/pt-BR.po
@@ -2859,4 +2859,3 @@ msgstr "Diminuir zoom"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/pt-PT.po b/locales/pt-PT.po
index 09f214cdf..db1bd6d21 100644
--- a/locales/pt-PT.po
+++ b/locales/pt-PT.po
@@ -2859,4 +2859,3 @@ msgstr "Afastar"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/ro-RO.po b/locales/ro-RO.po
index 820be2a00..6905b02b0 100644
--- a/locales/ro-RO.po
+++ b/locales/ro-RO.po
@@ -2859,4 +2859,3 @@ msgstr "Micșorează"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/ru-RU.po b/locales/ru-RU.po
index de5e6e18f..bd4810619 100644
--- a/locales/ru-RU.po
+++ b/locales/ru-RU.po
@@ -2859,4 +2859,3 @@ msgstr "Уменьшить"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Зулу"
-
diff --git a/locales/sk-SK.po b/locales/sk-SK.po
index 272eccfee..0ff1e72ef 100644
--- a/locales/sk-SK.po
+++ b/locales/sk-SK.po
@@ -2859,4 +2859,3 @@ msgstr "Oddialiť"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/sq-AL.po b/locales/sq-AL.po
index 7d6e8494c..8777e501e 100644
--- a/locales/sq-AL.po
+++ b/locales/sq-AL.po
@@ -2859,4 +2859,3 @@ msgstr "Zvogëlo"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/sr-SP.po b/locales/sr-SP.po
index 1b2f4b71e..f6f8968fc 100644
--- a/locales/sr-SP.po
+++ b/locales/sr-SP.po
@@ -2859,4 +2859,3 @@ msgstr "Умањи"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Зулу"
-
diff --git a/locales/sv-SE.po b/locales/sv-SE.po
index 30e2d2135..0f4e04c33 100644
--- a/locales/sv-SE.po
+++ b/locales/sv-SE.po
@@ -2859,4 +2859,3 @@ msgstr "Zooma ut"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/ta-IN.po b/locales/ta-IN.po
index 7d9f03e75..b284bb35d 100644
--- a/locales/ta-IN.po
+++ b/locales/ta-IN.po
@@ -2859,4 +2859,3 @@ msgstr "சிறிதாக்கு"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "ஜூலு"
-
diff --git a/locales/te-IN.po b/locales/te-IN.po
index 0b1eec60f..40d23b368 100644
--- a/locales/te-IN.po
+++ b/locales/te-IN.po
@@ -2859,4 +2859,3 @@ msgstr "జూమ్ అవుట్ చేయండి"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "జులు"
-
diff --git a/locales/th-TH.po b/locales/th-TH.po
index 592e600c1..9631fa470 100644
--- a/locales/th-TH.po
+++ b/locales/th-TH.po
@@ -2859,4 +2859,3 @@ msgstr "ซูมออก"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "ซูลู"
-
diff --git a/locales/tr-TR.po b/locales/tr-TR.po
index f76c1d109..c4a676920 100644
--- a/locales/tr-TR.po
+++ b/locales/tr-TR.po
@@ -2859,4 +2859,3 @@ msgstr "Uzaklaştır"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/uk-UA.po b/locales/uk-UA.po
index bcb1f1a09..7efda387c 100644
--- a/locales/uk-UA.po
+++ b/locales/uk-UA.po
@@ -2859,4 +2859,3 @@ msgstr "Зменшити"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Зулу"
-
diff --git a/locales/uz-UZ.po b/locales/uz-UZ.po
index e3b97ce67..e13d1cc43 100644
--- a/locales/uz-UZ.po
+++ b/locales/uz-UZ.po
@@ -2859,4 +2859,3 @@ msgstr "Kichraytirish"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/vi-VN.po b/locales/vi-VN.po
index 154c451f8..f51b10bbb 100644
--- a/locales/vi-VN.po
+++ b/locales/vi-VN.po
@@ -2859,4 +2859,3 @@ msgstr "Thu nhỏ"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "Zulu"
-
diff --git a/locales/zh-CN.po b/locales/zh-CN.po
index 09454b418..3c973c8b6 100644
--- a/locales/zh-CN.po
+++ b/locales/zh-CN.po
@@ -2859,4 +2859,3 @@ msgstr "缩小"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "祖鲁语"
-
diff --git a/locales/zh-TW.po b/locales/zh-TW.po
index 2ed3b5e05..71925614b 100644
--- a/locales/zh-TW.po
+++ b/locales/zh-TW.po
@@ -2859,4 +2859,3 @@ msgstr "縮小"
#: src/utils/locale.ts
msgid "Zulu"
msgstr "祖魯語"
-
diff --git a/package.json b/package.json
index b55c94ee8..7bd2b2388 100644
--- a/package.json
+++ b/package.json
@@ -31,9 +31,9 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
- "@ai-sdk/anthropic": "^3.0.33",
- "@ai-sdk/google": "^3.0.18",
- "@ai-sdk/openai": "^3.0.23",
+ "@ai-sdk/anthropic": "^3.0.35",
+ "@ai-sdk/google": "^3.0.20",
+ "@ai-sdk/openai": "^3.0.25",
"@aws-sdk/client-s3": "^3.980.0",
"@better-auth/core": "1.5.0-beta.11",
"@better-auth/passkey": "1.5.0-beta.11",
@@ -66,7 +66,7 @@
"@tiptap/pm": "^3.18.0",
"@tiptap/react": "^3.18.0",
"@tiptap/starter-kit": "^3.18.0",
- "ai": "^6.0.64",
+ "ai": "^6.0.67",
"ai-sdk-ollama": "^3.3.0",
"bcrypt": "^6.0.0",
"better-auth": "1.5.0-beta.11",
@@ -92,7 +92,7 @@
"react-dom": "^19.2.4",
"react-hook-form": "^7.71.1",
"react-hotkeys-hook": "^5.2.3",
- "react-resizable-panels": "^4.5.6",
+ "react-resizable-panels": "^4.5.8",
"react-window": "^2.2.6",
"react-zoom-pan-pinch": "^3.7.0",
"reflect-metadata": "^0.2.2",
@@ -110,7 +110,7 @@
"workbox-window": "^7.4.0",
"zod": "^4.3.6",
"zundo": "^2.3.0",
- "zustand": "^5.0.10"
+ "zustand": "^5.0.11"
},
"devDependencies": {
"@biomejs/biome": "^2.3.13",
@@ -120,7 +120,7 @@
"@tailwindcss/vite": "^4.1.18",
"@types/bcrypt": "^6.0.0",
"@types/js-cookie": "^3.0.6",
- "@types/node": "^25.1.0",
+ "@types/node": "^25.2.0",
"@types/nodemailer": "^7.0.9",
"@types/pg": "^8.16.0",
"@types/react": "^19.2.10",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f7ae4a4a8..e1790c431 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -12,14 +12,14 @@ importers:
.:
dependencies:
'@ai-sdk/anthropic':
- specifier: ^3.0.33
- version: 3.0.33([email protected])
+ specifier: ^3.0.35
+ version: 3.0.35([email protected])
'@ai-sdk/google':
- specifier: ^3.0.18
- version: 3.0.18([email protected])
+ specifier: ^3.0.20
+ version: 3.0.20([email protected])
'@ai-sdk/openai':
- specifier: ^3.0.23
- version: 3.0.23([email protected])
+ specifier: ^3.0.25
+ version: 3.0.25([email protected])
'@aws-sdk/client-s3':
specifier: ^3.980.0
version: 3.980.0
@@ -28,7 +28,7 @@ importers:
'@better-auth/passkey':
specifier: 1.5.0-beta.11
- version: 1.5.0-beta.11(bc77f1adfc1018afca90f6aeb483a6fa)
+ version: 1.5.0-beta.11(7c1c6a68850ab89ea33d06efcee04899)
'@dnd-kit/core':
specifier: ^6.3.1
@@ -94,7 +94,7 @@ importers:
'@tanstack/react-start':
specifier: ^1.157.18
'@tanstack/zod-adapter':
specifier: ^1.157.18
@@ -117,17 +117,17 @@ importers:
specifier: ^3.18.0
version: 3.18.0
ai:
- specifier: ^6.0.64
- version: 6.0.64([email protected])
+ specifier: ^6.0.67
+ version: 6.0.67([email protected])
ai-sdk-ollama:
specifier: ^3.3.0
bcrypt:
specifier: ^6.0.0
version: 6.0.0
better-auth:
specifier: 1.5.0-beta.11
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -195,8 +195,8 @@ importers:
specifier: ^5.2.3
react-resizable-panels:
- specifier: ^4.5.6
+ specifier: ^4.5.8
react-window:
specifier: ^2.2.6
@@ -208,7 +208,7 @@ importers:
version: 0.2.2
shadcn:
specifier: ^3.8.1
sharp:
specifier: ^0.34.5
version: 0.34.5
@@ -247,10 +247,10 @@ importers:
version: 4.3.6
zundo:
specifier: ^2.3.0
zustand:
- specifier: ^5.0.10
+ specifier: ^5.0.11
devDependencies:
'@biomejs/biome':
specifier: ^2.3.13
@@ -263,10 +263,10 @@ importers:
'@lingui/vite-plugin':
specifier: ^5.9.0
'@tailwindcss/vite':
specifier: ^4.1.18
'@types/bcrypt':
specifier: ^6.0.0
version: 6.0.0
@@ -274,8 +274,8 @@ importers:
specifier: ^3.0.6
version: 3.0.6
'@types/node':
- specifier: ^25.1.0
- version: 25.1.0
+ specifier: ^25.2.0
+ version: 25.2.0
'@types/nodemailer':
specifier: ^7.0.9
version: 7.0.9
@@ -290,7 +290,7 @@ importers:
version: 19.2.3(@types/[email protected])
'@vitejs/plugin-react':
specifier: ^5.1.2
babel-plugin-macros:
specifier: ^3.1.0
version: 3.1.0
@@ -299,10 +299,10 @@ importers:
version: 1.0.0-beta.9-e89174b
knip:
specifier: ^5.82.1
- version: 5.82.1(@types/[email protected])([email protected])
+ version: 5.82.1(@types/[email protected])([email protected])
nitro:
specifier: npm:nitro-nightly@latest
node-addon-api:
specifier: ^8.5.0
version: 8.5.0
@@ -320,39 +320,39 @@ importers:
version: 5.9.3
vite:
specifier: npm:rolldown-vite@latest
vite-plugin-pwa:
specifier: ^1.2.0
packages:
- '@ai-sdk/[email protected]':
- resolution: {integrity: sha512-MvQzipOAK99Ct3nX6d8oz2AJ9c8kbiU2uSpGYK3F5oBBa8Gy04+LbYBoB9oH8bbZJxFafkgwBq1+k8xpU7vVxQ==}
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-Y3g/5uVj621XSB9lGF7WrD7qR+orhV5xpaYkRF8kfj2j4W7e7BBGIvxcdsCf85FjJbc6tKQdNTZ84ZEqT3Y5TQ==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4.1.8
- '@ai-sdk/[email protected]':
- resolution: {integrity: sha512-zf6yXT+7DcVGWG7ntxVCYC48X/opsWlO5ePvgH8W9DaEVUtkemqKUEzBqowQ778PkZo8sqMnRfD0+fi9HamRRQ==}
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-7clZRr07P9rpur39t1RrbIe7x8jmwnwUWI8tZs+BvAfX3NFgdSVGGIaT7bTz2pb08jmLXzTSDbrOTqAQ7uBkBQ==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4.1.8
- '@ai-sdk/[email protected]':
- resolution: {integrity: sha512-g36Arlv38wjnqAhNlxMkfTvmWpMbD+FTFoXLppZ8dZhMQbr/UI5dEtFAByU1/lWeDyOmj/uTWzAuRTyJRw7OLA==}
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-bVGsulEr6JiipAFlclo9bjL5WaUV0iCSiiekLt+PY6pwmtJeuU2GaD9DoE3OqR8LN2W779mU13IhVEzlTupf8g==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4.1.8
- '@ai-sdk/[email protected]':
- resolution: {integrity: sha512-vFfFadJH+hbrgI4lhC9H/r8qPzuFJFUwZNS8oMI8KujO/woovbE1EWOOGMRGtNVL8PrhhxBfgJzvOKdux3c1gw==}
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-DsaN46R98+D1W3lU3fKuPU3ofacboLaHlkAwxJPgJ8eup1AJHmPK1N1y10eJJbJcF6iby8Tf/vanoZxc9JPUfw==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4.1.8
- '@ai-sdk/[email protected]':
- resolution: {integrity: sha512-y/WOPpcZaBjvNaogy83mBsCRPvbtaK0y1sY9ckRrrbTGMvG2HC/9Y/huqNXKnLAxUIME2PGa2uvF2CDwIsxoXQ==}
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-HHG72BN4d+OWTcq2NwTxOm/2qvk1duYsnhCDtsbYwn/h/4zeqURu1S0+Cn0nY2Ysq9a9HGKvrYuMn9bgFhR2Og==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4.1.8
@@ -367,8 +367,8 @@ packages:
resolution: {integrity: sha512-2Xmoq6DBJqmSl80U6V9z5jJSJP7ehaJJQMy2iFUqTay06wdCqTnPVBBQbtEL8RCChenL+q5DC5H5WzU3vV3v8w==}
engines: {node: '>=18'}
- '@ai-sdk/[email protected]':
- resolution: {integrity: sha512-hSfoJtLtpMd7YxKM+iTqlJ0ZB+kJ83WESMiWuWrNVey3X8gg97x0OdAAaeAeclZByCX3UdPOTqhvJdK8qYA3ww==}
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-VkPLrutM6VdA924/mG8OS+5frbVTcu6e046D2bgDo00tehBANR1QBJ/mPcZ9tXMFOsVcm6SQArOregxePzTFPw==}
engines: {node: '>=18'}
@@ -4211,8 +4211,8 @@ packages:
resolution: {integrity: sha512-P0nCgw6vzY23UxZMnbI4N7fnLGANt4LI4yvxze1paPj+LuN28cFv5EI+QidP8udnId/BKhkcRhm/BleNsjK65A==}
- '@types/[email protected]':
- resolution: {integrity: sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-DZ8VwRFUNzuqJ5khrvwMXHmvPe+zGayJhr2CDNiKB1WBE1ST8Djl00D0IC4vvNmHMdj6DlbYRIaFE7WHjlDl5w==}
resolution: {integrity: sha512-vI8oF1M+8JvQhsId0Pc38BdUP2evenIIys7c7p+9OZXSPOH5c1dyINP1jT8xQ2xPuBUXmIC87s+91IZMDjH8Ow==}
@@ -4305,8 +4305,8 @@ packages:
peerDependencies:
ai: ^6.0.48
- resolution: {integrity: sha512-eH+6FC2THf0rXamPOBAPGNBuMvqv4gE5+IKoWVBrO1TkrjwRiuP3+P6yl7/HcXzN9JLbVe3lL8yaTIfn0ZwvxQ==}
+ resolution: {integrity: sha512-xBnTcByHCj3OcG6V8G1s6zvSEqK0Bdiu+IEXYcpGrve1iGFFRgcrKeZtr/WAW/7gupnSvBbDF24BEv1OOfqi1g==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4.1.8
@@ -7031,8 +7031,8 @@ packages:
'@types/react':
optional: true
- resolution: {integrity: sha512-mgjS8lGvNXQWsTahZHyi4x/U/IUWihzxSykUomur7FSbAvPVhHoOgT3uiBfn+hfdYUgOHgxqbKaJQLWqmvh76w==}
+ resolution: {integrity: sha512-X2S5YoYWbjd7Ove6e6T/kzOrjiUD6ccz55a+XW0H3JXbrPb+Gmz7YRAJy4ysOkua/U5jSOG9SoySbebMBjtQJQ==}
peerDependencies:
react: ^18.0.0 || ^19.0.0
react-dom: ^18.0.0 || ^19.0.0
@@ -8148,8 +8148,8 @@ packages:
peerDependencies:
zustand: ^4.3.0 || ^5.0.0
- resolution: {integrity: sha512-U1AiltS1O9hSy3rul+Ub82ut2fqIAefiSuwECWt6jlMVUGejvf+5omLcRBSzqbRagSM3hQZbtzdeRc6QVScXTg==}
+ resolution: {integrity: sha512-fdZY+dk7zn/vbWNCYmzZULHRrss0jx5pPFiOuMZ/5HJN6Yv3u+1Wswy/4MpZEkEGhtNH+pwxZB8OKgUBPzYAGg==}
engines: {node: '>=12.20.0'}
peerDependencies:
'@types/react': '>=18.0.0'
@@ -8168,34 +8168,34 @@ packages:
snapshots:
dependencies:
- '@ai-sdk/provider': 3.0.6
- '@ai-sdk/provider-utils': 4.0.11([email protected])
+ '@ai-sdk/provider': 3.0.7
+ '@ai-sdk/provider-utils': 4.0.13([email protected])
zod: 4.3.6
dependencies:
- '@ai-sdk/provider': 3.0.6
- '@ai-sdk/provider-utils': 4.0.11([email protected])
+ '@ai-sdk/provider': 3.0.7
+ '@ai-sdk/provider-utils': 4.0.13([email protected])
'@vercel/oidc': 3.1.0
zod: 4.3.6
dependencies:
- '@ai-sdk/provider': 3.0.6
- '@ai-sdk/provider-utils': 4.0.11([email protected])
+ '@ai-sdk/provider': 3.0.7
+ '@ai-sdk/provider-utils': 4.0.13([email protected])
zod: 4.3.6
dependencies:
- '@ai-sdk/provider': 3.0.6
- '@ai-sdk/provider-utils': 4.0.11([email protected])
+ '@ai-sdk/provider': 3.0.7
+ '@ai-sdk/provider-utils': 4.0.13([email protected])
zod: 4.3.6
dependencies:
- '@ai-sdk/provider': 3.0.6
+ '@ai-sdk/provider': 3.0.7
'@standard-schema/spec': 1.1.0
eventsource-parser: 3.0.6
zod: 4.3.6
@@ -8211,7 +8211,7 @@ snapshots:
dependencies:
json-schema: 0.4.0
- '@ai-sdk/[email protected]':
+ '@ai-sdk/[email protected]':
dependencies:
json-schema: 0.4.0
@@ -9595,14 +9595,14 @@ snapshots:
'@better-auth/utils': 0.3.1
mongodb: 7.0.0([email protected])
- '@better-auth/[email protected](bc77f1adfc1018afca90f6aeb483a6fa)':
+ '@better-auth/[email protected](7c1c6a68850ab89ea33d06efcee04899)':
dependencies:
'@better-auth/utils': 0.3.1
'@better-fetch/fetch': 1.1.21
'@simplewebauthn/browser': 13.2.2
'@simplewebauthn/server': 13.2.2
better-call: 1.2.0([email protected])
nanostores: 1.1.0
zod: 4.3.6
@@ -10031,31 +10031,31 @@ snapshots:
'@inquirer/[email protected]': {}
- '@inquirer/[email protected](@types/[email protected])':
+ '@inquirer/[email protected](@types/[email protected])':
dependencies:
- '@inquirer/core': 10.3.2(@types/[email protected])
- '@inquirer/type': 3.0.10(@types/[email protected])
+ '@inquirer/core': 10.3.2(@types/[email protected])
+ '@inquirer/type': 3.0.10(@types/[email protected])
optionalDependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
- '@inquirer/[email protected](@types/[email protected])':
+ '@inquirer/[email protected](@types/[email protected])':
dependencies:
'@inquirer/ansi': 1.0.2
'@inquirer/figures': 1.0.15
- '@inquirer/type': 3.0.10(@types/[email protected])
+ '@inquirer/type': 3.0.10(@types/[email protected])
cli-width: 4.1.0
mute-stream: 2.0.0
signal-exit: 4.1.0
wrap-ansi: 6.2.0
yoctocolors-cjs: 2.1.3
optionalDependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
'@inquirer/[email protected]': {}
- '@inquirer/[email protected](@types/[email protected])':
+ '@inquirer/[email protected](@types/[email protected])':
optionalDependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
'@isaacs/[email protected]': {}
@@ -10085,7 +10085,7 @@ snapshots:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
'@types/yargs': 17.0.35
chalk: 4.1.2
@@ -10212,11 +10212,11 @@ snapshots:
'@lingui/babel-plugin-lingui-macro': 5.9.0([email protected])([email protected])
babel-plugin-macros: 3.1.0
dependencies:
'@lingui/cli': 5.9.0([email protected])([email protected])
'@lingui/conf': 5.9.0([email protected])
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@@ -12191,12 +12191,12 @@ snapshots:
'@tailwindcss/oxide-win32-arm64-msvc': 4.1.18
'@tailwindcss/oxide-win32-x64-msvc': 4.1.18
dependencies:
'@tailwindcss/node': 4.1.18
'@tailwindcss/oxide': 4.1.18
tailwindcss: 4.1.18
'@tanstack/[email protected]': {}
@@ -12251,19 +12251,19 @@ snapshots:
transitivePeerDependencies:
- crossws
dependencies:
'@tanstack/react-router': 1.157.18([email protected]([email protected]))([email protected])
'@tanstack/react-start-client': 1.157.18([email protected]([email protected]))([email protected])
'@tanstack/router-utils': 1.154.7
'@tanstack/start-client-core': 1.157.18
'@tanstack/start-server-core': 1.157.18([email protected]([email protected]))
pathe: 2.0.3
react: 19.2.4
react-dom: 19.2.4([email protected])
transitivePeerDependencies:
- '@rsbuild/core'
- crossws
@@ -12301,7 +12301,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@babel/core': 7.28.6
'@babel/plugin-syntax-jsx': 7.28.6(@babel/[email protected])
@@ -12319,7 +12319,7 @@ snapshots:
zod: 3.25.76
optionalDependencies:
'@tanstack/react-router': 1.157.18([email protected]([email protected]))([email protected])
transitivePeerDependencies:
- supports-color
@@ -12351,7 +12351,7 @@ snapshots:
'@tanstack/[email protected]': {}
dependencies:
'@babel/code-frame': 7.27.1
'@babel/core': 7.28.6
@@ -12359,7 +12359,7 @@ snapshots:
'@rolldown/pluginutils': 1.0.0-beta.40
'@tanstack/router-core': 1.157.18
'@tanstack/router-generator': 1.157.18
'@tanstack/router-utils': 1.154.7
'@tanstack/start-client-core': 1.157.18
'@tanstack/start-server-core': 1.157.18([email protected]([email protected]))
@@ -12370,8 +12370,8 @@ snapshots:
srvx: 0.10.1
tinyglobby: 0.2.15
ufo: 1.6.3
xmlbuilder2: 4.0.3
zod: 3.25.76
transitivePeerDependencies:
@@ -12635,7 +12635,7 @@ snapshots:
dependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
'@types/[email protected]': {}
@@ -12664,25 +12664,25 @@ snapshots:
dependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
tarn: 3.0.2
tedious: 19.2.0
transitivePeerDependencies:
- supports-color
- '@types/[email protected]':
+ '@types/[email protected]':
dependencies:
undici-types: 7.16.0
dependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
'@types/[email protected]': {}
dependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
pg-protocol: 1.11.0
pg-types: 2.2.0
@@ -12696,7 +12696,7 @@ snapshots:
dependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
'@types/[email protected]': {}
@@ -12722,7 +12722,7 @@ snapshots:
dependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
optional: true
'@typespec/[email protected]':
@@ -12735,7 +12735,7 @@ snapshots:
'@vercel/[email protected]': {}
dependencies:
'@babel/core': 7.28.6
'@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/[email protected])
@@ -12743,7 +12743,7 @@ snapshots:
'@rolldown/pluginutils': 1.0.0-beta.53
'@types/babel__core': 7.20.5
react-refresh: 0.18.0
transitivePeerDependencies:
- supports-color
@@ -12762,20 +12762,20 @@ snapshots:
dependencies:
'@ai-sdk/provider': 3.0.5
'@ai-sdk/provider-utils': 4.0.9([email protected])
- ai: 6.0.64([email protected])
+ ai: 6.0.67([email protected])
ollama: 0.6.3
transitivePeerDependencies:
- zod
dependencies:
- '@ai-sdk/gateway': 3.0.29([email protected])
- '@ai-sdk/provider': 3.0.6
- '@ai-sdk/provider-utils': 4.0.11([email protected])
+ '@ai-sdk/gateway': 3.0.32([email protected])
+ '@ai-sdk/provider': 3.0.7
+ '@ai-sdk/provider-utils': 4.0.13([email protected])
'@opentelemetry/api': 1.9.0
zod: 4.3.6
@@ -12947,7 +12947,7 @@ snapshots:
node-addon-api: 8.5.0
node-gyp-build: 4.8.4
dependencies:
@@ -12968,7 +12968,7 @@ snapshots:
zod: 4.3.6
optionalDependencies:
drizzle-kit: 1.0.0-beta.9-e89174b
mongodb: 7.0.0([email protected])
@@ -14428,10 +14428,10 @@ snapshots:
dependencies:
'@nodelib/fs.walk': 1.2.8
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
fast-glob: 3.3.3
formatly: 0.3.0
jiti: 2.6.1
@@ -14756,9 +14756,9 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
- '@inquirer/confirm': 5.1.21(@types/[email protected])
+ '@inquirer/confirm': 5.1.21(@types/[email protected])
'@mswjs/interceptors': 0.40.0
'@open-draft/deferred-promise': 2.2.0
'@types/statuses': 2.0.6
@@ -14811,7 +14811,7 @@ snapshots:
dependencies:
consola: 3.4.2
crossws: 0.4.3([email protected])
@@ -14830,7 +14830,7 @@ snapshots:
optionalDependencies:
rolldown: 1.0.0-beta.53
rollup: 2.79.2
transitivePeerDependencies:
- '@azure/app-configuration'
- '@azure/cosmos'
@@ -15584,7 +15584,7 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.10
dependencies:
react: 19.2.4
react-dom: 19.2.4([email protected])
@@ -15722,7 +15722,7 @@ snapshots:
dependencies:
'@oxc-project/runtime': 0.101.0
fdir: 6.5.0([email protected])
@@ -15732,7 +15732,7 @@ snapshots:
rolldown: 1.0.0-beta.53
tinyglobby: 0.2.15
optionalDependencies:
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
esbuild: 0.27.2
fsevents: 2.3.3
jiti: 2.6.1
@@ -15874,7 +15874,7 @@ snapshots:
dependencies:
'@antfu/ni': 25.0.0
'@babel/core': 7.28.6
@@ -15896,7 +15896,7 @@ snapshots:
fuzzysort: 3.1.0
https-proxy-agent: 7.0.6
kleur: 4.1.5
- msw: 2.12.7(@types/[email protected])([email protected])
+ msw: 2.12.7(@types/[email protected])([email protected])
node-fetch: 3.3.2
open: 11.0.0
ora: 8.2.0
@@ -16214,7 +16214,7 @@ snapshots:
'@azure/identity': 4.13.0
'@azure/keyvault-keys': 4.10.0
'@js-joda/core': 5.6.5
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
bl: 6.1.6
iconv-lite: 0.6.3
js-md4: 0.3.2
@@ -16229,7 +16229,7 @@ snapshots:
'@azure/identity': 4.13.0
'@azure/keyvault-keys': 4.10.0
'@js-joda/core': 5.6.5
- '@types/node': 25.1.0
+ '@types/node': 25.2.0
bl: 6.1.6
iconv-lite: 0.7.2
js-md4: 0.3.2
@@ -16506,20 +16506,20 @@ snapshots:
dependencies:
debug: 4.4.3
pretty-bytes: 6.1.1
tinyglobby: 0.2.15
workbox-build: 7.4.0(@types/[email protected])
workbox-window: 7.4.0
transitivePeerDependencies:
- supports-color
optionalDependencies:
@@ -16809,11 +16809,11 @@ snapshots:
dependencies:
optionalDependencies:
'@types/react': 19.2.10
immer: 11.1.3
diff --git a/src/integrations/orpc/client.ts b/src/integrations/orpc/client.ts
index 54d00668d..871146c9e 100644
--- a/src/integrations/orpc/client.ts
+++ b/src/integrations/orpc/client.ts
@@ -1,4 +1,4 @@
-import { createORPCClient, onError } from "@orpc/client";
+import { createORPCClient } from "@orpc/client";
import { RPCLink } from "@orpc/client/fetch";
import { BatchLinkPlugin } from "@orpc/client/plugins";
import { createRouterClient, type InferRouterInputs, type InferRouterOutputs, type RouterClient } from "@orpc/server";
@@ -11,11 +11,11 @@ import { getLocale } from "@/utils/locale";
export const getORPCClient = createIsomorphicFn()
.server((): RouterClient<typeof router> => {
return createRouterClient(router, {
- interceptors: [
- onError((error) => {
- console.error(error);
- }),
- ],
+ // interceptors: [
+ // onError((error) => {
+ // console.error(error);
+ // }),
+ // ],
context: async () => {
const locale = await getLocale();
const reqHeaders = getRequestHeaders();
@@ -33,12 +33,12 @@ export const getORPCClient = createIsomorphicFn()
fetch: (request, init) => {
return fetch(request, { ...init, credentials: "include" });
},
- interceptors: [
- onError((error) => {
- if (error instanceof DOMException) return;
- console.error(error);
- }),
- ],
+ // interceptors: [
+ // onError((error) => {
+ // if (error instanceof DOMException) return;
+ // console.error(error);
+ // }),
+ // ],
plugins: [new BatchLinkPlugin({ groups: [{ condition: () => true, context: {} }] })],
});
diff --git a/src/integrations/orpc/router/ai.ts b/src/integrations/orpc/router/ai.ts
index b01ce3d0b..4d6c07183 100644
--- a/src/integrations/orpc/router/ai.ts
+++ b/src/integrations/orpc/router/ai.ts
@@ -1,52 +1,8 @@
-import { createAnthropic } from "@ai-sdk/anthropic";
-import { createGoogleGenerativeAI } from "@ai-sdk/google";
-import { createOpenAI } from "@ai-sdk/openai";
-import { createGateway, generateText, Output, streamText } from "ai";
-import { createOllama } from "ai-sdk-ollama";
-import { match } from "ts-pattern";
-import z, { flattenError, ZodError } from "zod";
-import docxParserSystemPrompt from "@/integrations/ai/prompts/docx-parser-system.md?raw";
-import docxParserUserPrompt from "@/integrations/ai/prompts/docx-parser-user.md?raw";
-import pdfParserSystemPrompt from "@/integrations/ai/prompts/pdf-parser-system.md?raw";
-import pdfParserUserPrompt from "@/integrations/ai/prompts/pdf-parser-user.md?raw";
-import { defaultResumeData, resumeDataSchema } from "@/schema/resume/data";
+import { ORPCError } from "@orpc/client";
+import { AISDKError } from "ai";
+import z, { ZodError } from "zod";
import { protectedProcedure } from "../context";
-
-const aiProviderSchema = z.enum(["ollama", "openai", "gemini", "anthropic", "vercel-ai-gateway"]);
-
-type AIProvider = z.infer<typeof aiProviderSchema>;
-
-type GetModelInput = {
- provider: AIProvider;
- model: string;
- apiKey: string;
- baseURL: string;
-};
-
-function getModel(input: GetModelInput) {
- const { provider, model, apiKey } = input;
- const baseURL = input.baseURL || undefined;
-
- return match(provider)
- .with("openai", () => createOpenAI({ apiKey, baseURL }).languageModel(model))
- .with("ollama", () => createOllama({ apiKey, baseURL }).languageModel(model))
- .with("anthropic", () => createAnthropic({ apiKey, baseURL }).languageModel(model))
- .with("vercel-ai-gateway", () => createGateway({ apiKey, baseURL }).languageModel(model))
- .with("gemini", () => createGoogleGenerativeAI({ apiKey, baseURL }).languageModel(model))
- .exhaustive();
-}
-
-const aiCredentialsSchema = z.object({
- provider: aiProviderSchema,
- model: z.string(),
- apiKey: z.string(),
- baseURL: z.string(),
-});
-
-const fileInputSchema = z.object({
- name: z.string(),
- data: z.string(), // base64 encoded
-});
+import { aiCredentialsSchema, aiProviderSchema, aiService, fileInputSchema, formatZodError } from "../services/ai";
export const aiRouter = {
testConnection: protectedProcedure
@@ -58,14 +14,16 @@ export const aiRouter = {
baseURL: z.string(),
}),
)
- .handler(async function* ({ input }) {
- const stream = streamText({
- temperature: 0,
- model: getModel(input),
- messages: [{ role: "user", content: 'Respond with "1"' }],
- });
+ .handler(async ({ input }) => {
+ try {
+ return await aiService.testConnection(input);
+ } catch (error) {
+ if (error instanceof AISDKError) {
+ throw new ORPCError("BAD_GATEWAY", { message: error.message });
+ }
- yield* stream.textStream;
+ throw error;
+ }
}),
parsePdf: protectedProcedure
@@ -77,44 +35,15 @@ export const aiRouter = {
)
.handler(async ({ input }) => {
try {
- const model = getModel(input);
-
- const result = await generateText({
- model,
- maxRetries: 0,
- output: Output.object({ schema: resumeDataSchema }),
- messages: [
- {
- role: "system",
- content: pdfParserSystemPrompt,
- },
- {
- role: "user",
- content: [
- { type: "text", text: pdfParserUserPrompt },
- {
- type: "file",
- filename: input.file.name,
- mediaType: "application/pdf",
- data: input.file.data,
- },
- ],
- },
- ],
- });
-
- return resumeDataSchema.parse({
- ...result.output,
- customSections: [],
- picture: defaultResumeData.picture,
- metadata: defaultResumeData.metadata,
- });
+ return await aiService.parsePdf(input);
} catch (error) {
- if (error instanceof ZodError) {
- const errors = flattenError(error);
- throw new Error(JSON.stringify(errors));
+ if (error instanceof AISDKError) {
+ throw new ORPCError("BAD_GATEWAY", { message: error.message });
}
+ if (error instanceof ZodError) {
+ throw new Error(formatZodError(error));
+ }
throw error;
}
}),
@@ -132,39 +61,14 @@ export const aiRouter = {
)
.handler(async ({ input }) => {
try {
- const model = getModel(input);
-
- const result = await generateText({
- model,
- maxRetries: 0,
- output: Output.object({ schema: resumeDataSchema }),
- messages: [
- { role: "system", content: docxParserSystemPrompt },
- {
- role: "user",
- content: [
- { type: "text", text: docxParserUserPrompt },
- {
- type: "file",
- filename: input.file.name,
- mediaType: input.mediaType,
- data: input.file.data,
- },
- ],
- },
- ],
- });
-
- return resumeDataSchema.parse({
- ...result.output,
- customSections: [],
- picture: defaultResumeData.picture,
- metadata: defaultResumeData.metadata,
- });
+ return await aiService.parseDocx(input);
} catch (error) {
+ if (error instanceof AISDKError) {
+ throw new ORPCError("BAD_GATEWAY", { message: error.message });
+ }
+
if (error instanceof ZodError) {
- const errors = flattenError(error);
- throw new Error(JSON.stringify(errors));
+ throw new Error(formatZodError(error));
}
throw error;
diff --git a/src/integrations/orpc/services/ai.ts b/src/integrations/orpc/services/ai.ts
new file mode 100644
index 000000000..508f9bcfd
--- /dev/null
+++ b/src/integrations/orpc/services/ai.ts
@@ -0,0 +1,148 @@
+import { createAnthropic } from "@ai-sdk/anthropic";
+import { createGoogleGenerativeAI } from "@ai-sdk/google";
+import { createOpenAI } from "@ai-sdk/openai";
+import { createGateway, generateText, Output } from "ai";
+import { createOllama } from "ai-sdk-ollama";
+import { match } from "ts-pattern";
+import type { ZodError } from "zod";
+import z, { flattenError } from "zod";
+import docxParserSystemPrompt from "@/integrations/ai/prompts/docx-parser-system.md?raw";
+import docxParserUserPrompt from "@/integrations/ai/prompts/docx-parser-user.md?raw";
+import pdfParserSystemPrompt from "@/integrations/ai/prompts/pdf-parser-system.md?raw";
+import pdfParserUserPrompt from "@/integrations/ai/prompts/pdf-parser-user.md?raw";
+import type { ResumeData } from "@/schema/resume/data";
+import { defaultResumeData, resumeDataSchema } from "@/schema/resume/data";
+
+export const aiProviderSchema = z.enum(["ollama", "openai", "gemini", "anthropic", "vercel-ai-gateway"]);
+
+export type AIProvider = z.infer<typeof aiProviderSchema>;
+
+export type GetModelInput = {
+ provider: AIProvider;
+ model: string;
+ apiKey: string;
+ baseURL: string;
+};
+
+function getModel(input: GetModelInput) {
+ const { provider, model, apiKey } = input;
+ const baseURL = input.baseURL || undefined;
+
+ return match(provider)
+ .with("openai", () => createOpenAI({ apiKey, baseURL }).languageModel(model))
+ .with("ollama", () => createOllama({ apiKey, baseURL }).languageModel(model))
+ .with("anthropic", () => createAnthropic({ apiKey, baseURL }).languageModel(model))
+ .with("vercel-ai-gateway", () => createGateway({ apiKey, baseURL }).languageModel(model))
+ .with("gemini", () => createGoogleGenerativeAI({ apiKey, baseURL }).languageModel(model))
+ .exhaustive();
+}
+
+export const aiCredentialsSchema = z.object({
+ provider: aiProviderSchema,
+ model: z.string(),
+ apiKey: z.string(),
+ baseURL: z.string(),
+});
+
+export const fileInputSchema = z.object({
+ name: z.string(),
+ data: z.string(), // base64 encoded
+});
+
+export type TestConnectionInput = z.infer<typeof aiCredentialsSchema>;
+
+export async function testConnection(input: TestConnectionInput): Promise<boolean> {
+ const RESPONSE_OK = "1";
+
+ const result = await generateText({
+ model: getModel(input),
+ output: Output.choice({ options: [RESPONSE_OK] }),
+ messages: [{ role: "user", content: `Respond with "${RESPONSE_OK}"` }],
+ });
+
+ return result.output === RESPONSE_OK;
+}
+
+export type ParsePdfInput = z.infer<typeof aiCredentialsSchema> & {
+ file: z.infer<typeof fileInputSchema>;
+};
+
+export async function parsePdf(input: ParsePdfInput): Promise<ResumeData> {
+ const model = getModel(input);
+
+ const result = await generateText({
+ model,
+ output: Output.object({ schema: resumeDataSchema }),
+ messages: [
+ {
+ role: "system",
+ content: pdfParserSystemPrompt,
+ },
+ {
+ role: "user",
+ content: [
+ { type: "text", text: pdfParserUserPrompt },
+ {
+ type: "file",
+ filename: input.file.name,
+ mediaType: "application/pdf",
+ data: input.file.data,
+ },
+ ],
+ },
+ ],
+ });
+
+ return resumeDataSchema.parse({
+ ...result.output,
+ customSections: [],
+ picture: defaultResumeData.picture,
+ metadata: defaultResumeData.metadata,
+ });
+}
+
+export type ParseDocxInput = z.infer<typeof aiCredentialsSchema> & {
+ file: z.infer<typeof fileInputSchema>;
+ mediaType: "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
+};
+
+export async function parseDocx(input: ParseDocxInput): Promise<ResumeData> {
+ const model = getModel(input);
+
+ const result = await generateText({
+ model,
+ output: Output.object({ schema: resumeDataSchema }),
+ messages: [
+ { role: "system", content: docxParserSystemPrompt },
+ {
+ role: "user",
+ content: [
+ { type: "text", text: docxParserUserPrompt },
+ {
+ type: "file",
+ filename: input.file.name,
+ mediaType: input.mediaType,
+ data: input.file.data,
+ },
+ ],
+ },
+ ],
+ });
+
+ return resumeDataSchema.parse({
+ ...result.output,
+ customSections: [],
+ picture: defaultResumeData.picture,
+ metadata: defaultResumeData.metadata,
+ });
+}
+
+export function formatZodError(error: ZodError): string {
+ return JSON.stringify(flattenError(error));
+}
+
+export const aiService = {
+ testConnection,
+ parsePdf,
+ parseDocx,
+};
diff --git a/src/integrations/orpc/services/storage.ts b/src/integrations/orpc/services/storage.ts
index 61ac2a199..81da60266 100644
--- a/src/integrations/orpc/services/storage.ts
+++ b/src/integrations/orpc/services/storage.ts
@@ -286,8 +286,6 @@ class S3StorageService implements StorageService {
message: "S3 storage is accessible and credentials are valid.",
};
} catch (error: unknown) {
- console.error(error);
-
return {
type: "s3",
status: "unhealthy",
diff --git a/src/routes/api/openapi.$.ts b/src/routes/api/openapi.$.ts
index ad46216a2..0e7cfa34a 100644
--- a/src/routes/api/openapi.$.ts
+++ b/src/routes/api/openapi.$.ts
@@ -1,7 +1,6 @@
import { SmartCoercionPlugin } from "@orpc/json-schema";
import { OpenAPIGenerator } from "@orpc/openapi";
import { OpenAPIHandler } from "@orpc/openapi/fetch";
-import { onError } from "@orpc/server";
import { RequestHeadersPlugin } from "@orpc/server/plugins";
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
import { createFileRoute } from "@tanstack/react-router";
@@ -10,11 +9,11 @@ import { env } from "@/utils/env";
import { getLocale } from "@/utils/locale";
const openAPIHandler = new OpenAPIHandler(router, {
- interceptors: [
- onError((error) => {
- console.error(error);
- }),
- ],
+ // interceptors: [
+ // onError((error) => {
+ // console.error(error);
+ // }),
+ // ],
plugins: [
new RequestHeadersPlugin(),
new SmartCoercionPlugin({
diff --git a/src/routes/api/rpc.$.ts b/src/routes/api/rpc.$.ts
index d9d8fe3c9..f0cf563ba 100644
--- a/src/routes/api/rpc.$.ts
+++ b/src/routes/api/rpc.$.ts
@@ -1,4 +1,3 @@
-import { onError } from "@orpc/server";
import { RPCHandler } from "@orpc/server/fetch";
import { BatchHandlerPlugin, RequestHeadersPlugin } from "@orpc/server/plugins";
import { createFileRoute } from "@tanstack/react-router";
@@ -6,11 +5,11 @@ import router from "@/integrations/orpc/router";
import { getLocale } from "@/utils/locale";
const rpcHandler = new RPCHandler(router, {
- interceptors: [
- onError((error) => {
- console.error(error);
- }),
- ],
+ // interceptors: [
+ // onError((error) => {
+ // console.error(error);
+ // }),
+ // ],
plugins: [new BatchHandlerPlugin(), new RequestHeadersPlugin()],
});
diff --git a/src/routes/builder/$resumeId/-components/dock.tsx b/src/routes/builder/$resumeId/-components/dock.tsx
index a8e1a7fed..893c20bd0 100644
--- a/src/routes/builder/$resumeId/-components/dock.tsx
+++ b/src/routes/builder/$resumeId/-components/dock.tsx
@@ -82,9 +82,8 @@ export function BuilderDock() {
try {
const { url } = await printResumeAsPDF({ id: resume.id });
downloadFromUrl(url, filename);
- } catch (error) {
+ } catch {
toast.error(t`There was a problem while generating the PDF, please try again in some time.`);
- console.error("[Error from printResumeAsPDF]:", error);
} finally {
toast.dismiss(toastId);
}
diff --git a/src/routes/builder/$resumeId/-sidebar/right/sections/export.tsx b/src/routes/builder/$resumeId/-sidebar/right/sections/export.tsx
index c42048ced..8cf60bbac 100644
--- a/src/routes/builder/$resumeId/-sidebar/right/sections/export.tsx
+++ b/src/routes/builder/$resumeId/-sidebar/right/sections/export.tsx
@@ -34,9 +34,8 @@ export function ExportSectionBuilder() {
try {
const { url } = await printResumeAsPDF({ id: resume.id });
downloadFromUrl(url, filename);
- } catch (error) {
+ } catch {
toast.error(t`There was a problem while generating the PDF, please try again in some time.`);
- console.error("[Error from printResumeAsPDF]:", error);
} finally {
toast.dismiss(toastId);
}
diff --git a/src/routes/dashboard/-components/sidebar.tsx b/src/routes/dashboard/-components/sidebar.tsx
index c0b098dc3..920bb3a33 100644
--- a/src/routes/dashboard/-components/sidebar.tsx
+++ b/src/routes/dashboard/-components/sidebar.tsx
@@ -179,7 +179,7 @@ export function DashboardSidebar() {
animate={{ y: 0, height: "auto", opacity: 1 }}
exit={{ y: 50, height: 0, opacity: 0 }}
>
- <Copyright className="shrink-0 break-words whitespace-normal p-2" />
+ <Copyright className="wrap-break-word shrink-0 whitespace-normal p-2" />
</motion.div>
)}
</AnimatePresence>
diff --git a/src/routes/dashboard/settings/ai.tsx b/src/routes/dashboard/settings/ai.tsx
index cdc8b33b1..73ba9f29f 100644
--- a/src/routes/dashboard/settings/ai.tsx
+++ b/src/routes/dashboard/settings/ai.tsx
@@ -5,6 +5,7 @@ import { useMutation } from "@tanstack/react-query";
import { createFileRoute } from "@tanstack/react-router";
import { motion } from "motion/react";
import { useMemo } from "react";
+import { toast } from "sonner";
import { useIsClient } from "usehooks-ts";
import { Button } from "@/components/ui/button";
import { Combobox, type ComboboxOption } from "@/components/ui/combobox";
@@ -14,7 +15,7 @@ import { Separator } from "@/components/ui/separator";
import { Spinner } from "@/components/ui/spinner";
import { Switch } from "@/components/ui/switch";
import { type AIProvider, useAIStore } from "@/integrations/ai/store";
-import { client } from "@/integrations/orpc/client";
+import { orpc } from "@/integrations/orpc/client";
import { cn } from "@/utils/style";
import { DashboardHeader } from "../-components/header";
@@ -62,19 +63,7 @@ function AIForm() {
return providerOptions.find((option) => option.value === provider);
}, [provider]);
- const { mutate: testConnection, isPending: isTesting } = useMutation({
- mutationFn: async () => {
- if (testStatus === "success") return;
- const stream = await client.ai.testConnection({ provider, model, apiKey, baseURL });
- let result = "";
- for await (const chunk of stream) {
- result += chunk;
- }
- set((draft) => {
- draft.testStatus = result === "1" ? "success" : "failure";
- });
- },
- });
+ const { mutate: testConnection, isPending: isTesting } = useMutation(orpc.ai.testConnection.mutationOptions());
const handleProviderChange = (value: AIProvider | null) => {
if (!value) return;
@@ -101,6 +90,22 @@ function AIForm() {
});
};
+ const handleTestConnection = () => {
+ testConnection(
+ { provider, model, apiKey, baseURL },
+ {
+ onSuccess: (data) => {
+ set((draft) => {
+ draft.testStatus = data ? "success" : "failure";
+ });
+ },
+ onError: (error) => {
+ toast.error(error.message);
+ },
+ },
+ );
+ };
+
return (
<div className="grid gap-6 sm:grid-cols-2">
<div className="flex flex-col gap-y-2">
@@ -158,7 +163,7 @@ function AIForm() {
</div>
<div>
- <Button variant="outline" disabled={isTesting || enabled} onClick={() => testConnection()}>
+ <Button variant="outline" disabled={isTesting || enabled} onClick={handleTestConnection}>
{isTesting ? (
<Spinner />
) : testStatus === "success" ? (