larkup 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/app-path-routes-manifest.json +22 -22
- package/.next/standalone/apps/web/.next/build-manifest.json +2 -2
- package/.next/standalone/apps/web/.next/required-server-files.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/add/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/add.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/add.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/add.segments/_full.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/add.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/add.segments/add/__PAGE__.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/api/chat/route.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_full.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/data/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/data.segments/_full.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/data.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.segments/data/__PAGE__.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/widget-demo/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/widget-demo.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/widget-demo.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/widget-demo.segments/_full.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app/widget-demo.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/widget-demo.segments/widget-demo/__PAGE__.segment.rsc +10 -10
- package/.next/standalone/apps/web/.next/server/app-paths-manifest.json +22 -22
- package/.next/standalone/apps/web/.next/server/chunks/7667.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/8021.js +1 -1
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/app/layout-eb9af9f94c483f59.js +1 -0
- package/.next/standalone/apps/web/bin/larkup.js +49 -30
- package/.next/standalone/apps/web/lib/release-metadata.test.ts +16 -0
- package/.next/standalone/apps/web/package.json +9 -9
- package/.next/standalone/apps/web/server.js +1 -1
- package/LICENSE +176 -0
- package/bin/larkup.js +49 -30
- package/package.json +19 -19
- package/.next/standalone/apps/web/.next/static/chunks/app/layout-c136fbb6866e6cd6.js +0 -1
- /package/.next/standalone/apps/web/.next/static/{GQeMEE7gggwSdSXw8YNlT → 1soft7HLkhEb-1XnNXTB3}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{GQeMEE7gggwSdSXw8YNlT → 1soft7HLkhEb-1XnNXTB3}/_ssgManifest.js +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/bin/larkup.js
CHANGED
|
@@ -46,43 +46,36 @@ if (command === '--version' || command === '-v') {
|
|
|
46
46
|
void openWhenReady(url);
|
|
47
47
|
} else if (command === 'update') {
|
|
48
48
|
const currentVersion = pkg.version;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (data.version) latestVersion = data.version;
|
|
58
|
-
}
|
|
59
|
-
} catch {}
|
|
60
|
-
|
|
61
|
-
const compareVersions = (a, b) => {
|
|
62
|
-
const pa = a.replace(/^v/, '').split('.').map(Number);
|
|
63
|
-
const pb = b.replace(/^v/, '').split('.').map(Number);
|
|
64
|
-
for (let i = 0; i < 3; i++) {
|
|
65
|
-
if ((pa[i] || 0) > (pb[i] || 0)) return 1;
|
|
66
|
-
if ((pa[i] || 0) < (pb[i] || 0)) return -1;
|
|
67
|
-
}
|
|
68
|
-
return 0;
|
|
69
|
-
};
|
|
49
|
+
const latestVersion = await getLatestPublishedVersion();
|
|
50
|
+
|
|
51
|
+
if (!latestVersion) {
|
|
52
|
+
console.error(
|
|
53
|
+
'Could not check for a Larkup update. Please check your connection and try again.',
|
|
54
|
+
);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
70
57
|
|
|
71
58
|
if (compareVersions(latestVersion, currentVersion) <= 0) {
|
|
72
59
|
console.log('');
|
|
73
|
-
console.log('\x1b[1m
|
|
60
|
+
console.log('\x1b[1m╭─ Larkup update ──────────────────────────────╮\x1b[0m');
|
|
74
61
|
console.log(
|
|
75
|
-
'\x1b[1m│ \x1b[32m✓\x1b[0m\x1b[1m
|
|
62
|
+
'\x1b[1m│ \x1b[32m✓\x1b[0m\x1b[1m You already have the latest version. │\x1b[0m',
|
|
76
63
|
);
|
|
77
64
|
console.log(
|
|
78
|
-
`\x1b[1m│ Larkup
|
|
65
|
+
`\x1b[1m│ Larkup ${currentVersion}${' '.repeat(Math.max(1, 35 - currentVersion.length))}│\x1b[0m`,
|
|
79
66
|
);
|
|
80
67
|
console.log('\x1b[1m╰──────────────────────────────────────────────╯\x1b[0m');
|
|
81
68
|
console.log('');
|
|
82
69
|
process.exit(0);
|
|
83
70
|
}
|
|
84
71
|
|
|
85
|
-
console.log(
|
|
72
|
+
console.log('');
|
|
73
|
+
console.log('\x1b[1m╭─ Larkup update ──────────────────────────────╮\x1b[0m');
|
|
74
|
+
console.log(
|
|
75
|
+
`\x1b[1m│ Updating ${currentVersion} → ${latestVersion}${' '.repeat(Math.max(1, 26 - currentVersion.length - latestVersion.length))}│\x1b[0m`,
|
|
76
|
+
);
|
|
77
|
+
console.log('\x1b[1m╰──────────────────────────────────────────────╯\x1b[0m');
|
|
78
|
+
console.log('');
|
|
86
79
|
await migrateLegacyRuntimeState();
|
|
87
80
|
const child = spawn(
|
|
88
81
|
'npm',
|
|
@@ -94,8 +87,7 @@ if (command === '--version' || command === '-v') {
|
|
|
94
87
|
'--ignore-scripts',
|
|
95
88
|
'--legacy-peer-deps',
|
|
96
89
|
'--loglevel=error',
|
|
97
|
-
|
|
98
|
-
'@larkup/cli@latest',
|
|
90
|
+
`larkup@${latestVersion}`,
|
|
99
91
|
],
|
|
100
92
|
{ stdio: 'inherit' },
|
|
101
93
|
);
|
|
@@ -106,11 +98,11 @@ if (command === '--version' || command === '-v') {
|
|
|
106
98
|
child.once('exit', (code) => {
|
|
107
99
|
if (code === 0) {
|
|
108
100
|
console.log('');
|
|
109
|
-
console.log('\x1b[1m
|
|
101
|
+
console.log('\x1b[1m╭─ Larkup update ──────────────────────────────╮\x1b[0m');
|
|
110
102
|
console.log(
|
|
111
|
-
`\x1b[1m│ \x1b[32m✓\x1b[0m\x1b[1m Updated to ${latestVersion}
|
|
103
|
+
`\x1b[1m│ \x1b[32m✓\x1b[0m\x1b[1m Updated to ${latestVersion}.${' '.repeat(Math.max(1, 31 - latestVersion.length))}│\x1b[0m`,
|
|
112
104
|
);
|
|
113
|
-
console.log('\x1b[1m│
|
|
105
|
+
console.log('\x1b[1m│ Run larkup --version to confirm. │\x1b[0m');
|
|
114
106
|
console.log('\x1b[1m╰──────────────────────────────────────────────╯\x1b[0m');
|
|
115
107
|
console.log('');
|
|
116
108
|
}
|
|
@@ -134,6 +126,33 @@ function option(args, name) {
|
|
|
134
126
|
: undefined;
|
|
135
127
|
}
|
|
136
128
|
|
|
129
|
+
async function getLatestPublishedVersion() {
|
|
130
|
+
const controller = new AbortController();
|
|
131
|
+
const timeout = setTimeout(() => controller.abort(), 5_000);
|
|
132
|
+
try {
|
|
133
|
+
const response = await fetch('https://registry.npmjs.org/larkup/latest', {
|
|
134
|
+
signal: controller.signal,
|
|
135
|
+
});
|
|
136
|
+
if (!response.ok) return undefined;
|
|
137
|
+
const release = await response.json();
|
|
138
|
+
return typeof release.version === 'string' ? release.version : undefined;
|
|
139
|
+
} catch {
|
|
140
|
+
return undefined;
|
|
141
|
+
} finally {
|
|
142
|
+
clearTimeout(timeout);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function compareVersions(a, b) {
|
|
147
|
+
const pa = a.replace(/^v/, '').split('.').map(Number);
|
|
148
|
+
const pb = b.replace(/^v/, '').split('.').map(Number);
|
|
149
|
+
for (let i = 0; i < 3; i++) {
|
|
150
|
+
if ((pa[i] || 0) > (pb[i] || 0)) return 1;
|
|
151
|
+
if ((pa[i] || 0) < (pb[i] || 0)) return -1;
|
|
152
|
+
}
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
137
156
|
function enterpriseEndpoint(baseUrl, pathname) {
|
|
138
157
|
const url = new URL(pathname, baseUrl);
|
|
139
158
|
if (url.protocol !== 'https:' && url.hostname !== 'localhost' && url.hostname !== '127.0.0.1') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "larkup",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22"
|
|
6
6
|
},
|
|
@@ -12,15 +12,6 @@
|
|
|
12
12
|
"bin",
|
|
13
13
|
".next/standalone/apps/web"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "next dev -p 4567",
|
|
17
|
-
"build": "next build --webpack",
|
|
18
|
-
"postbuild": "node scripts/prepare-standalone.mjs && if pnpm exec prettier --version >/dev/null 2>&1; then pnpm exec prettier --write next-env.d.ts; fi",
|
|
19
|
-
"start": "node .next/standalone/apps/web/server.js",
|
|
20
|
-
"lint": "echo \"No lint configured\"",
|
|
21
|
-
"test": "vitest run",
|
|
22
|
-
"type-check": "tsc --noEmit"
|
|
23
|
-
},
|
|
24
15
|
"dependencies": {
|
|
25
16
|
"@ai-sdk/anthropic": "^4.0.15",
|
|
26
17
|
"@ai-sdk/cohere": "4.0.35",
|
|
@@ -33,14 +24,14 @@
|
|
|
33
24
|
"@ai-sdk/react": "4.0.90",
|
|
34
25
|
"@base-ui/react": "^1.5.0",
|
|
35
26
|
"@lancedb/lancedb": "^0.38.0",
|
|
36
|
-
"@larkup/connections": "
|
|
37
|
-
"@larkup/core": "
|
|
38
|
-
"@larkup/integrations": "
|
|
39
|
-
"@larkup/marketplace": "
|
|
40
|
-
"@larkup/sandbox": "
|
|
41
|
-
"@larkup/scraper": "
|
|
42
|
-
"@larkup/tool-doc-editor": "
|
|
43
|
-
"@larkup/vector-stores": "
|
|
27
|
+
"@larkup/connections": "^0.2.0",
|
|
28
|
+
"@larkup/core": "^0.5.2",
|
|
29
|
+
"@larkup/integrations": "^0.2.1",
|
|
30
|
+
"@larkup/marketplace": "^0.2.2",
|
|
31
|
+
"@larkup/sandbox": "^0.1.4",
|
|
32
|
+
"@larkup/scraper": "^0.1.41",
|
|
33
|
+
"@larkup/tool-doc-editor": "^0.2.19",
|
|
34
|
+
"@larkup/vector-stores": "^0.1.27",
|
|
44
35
|
"@napi-rs/canvas": "1.0.8",
|
|
45
36
|
"@tauri-apps/plugin-process": "^2.3.1",
|
|
46
37
|
"@tauri-apps/plugin-updater": "^2.10.1",
|
|
@@ -88,5 +79,14 @@
|
|
|
88
79
|
"tailwindcss": "^4.2.0",
|
|
89
80
|
"typescript": "^7.0.2",
|
|
90
81
|
"vitest": "^4.1.10"
|
|
82
|
+
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"dev": "next dev -p 4567",
|
|
85
|
+
"build": "next build --webpack",
|
|
86
|
+
"postbuild": "node scripts/prepare-standalone.mjs && if pnpm exec prettier --version >/dev/null 2>&1; then pnpm exec prettier --write next-env.d.ts; fi",
|
|
87
|
+
"start": "node .next/standalone/apps/web/server.js",
|
|
88
|
+
"lint": "echo \"No lint configured\"",
|
|
89
|
+
"test": "vitest run",
|
|
90
|
+
"type-check": "tsc --noEmit"
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{19726:(e,s,t)=>{"use strict";t.d(s,{GlobalIndexProgress:()=>E});var n=t(6190),r=t(99483),a=t(34321),l=t(47614),i=t(17140),d=t(51353),o=t(30218),c=t(23027),u=t(78529),x=t(79399),m=t(26912);t(96474),t(44654);var h=t(87172),g=t(62921),p=t(19821),f=t(86494),j=t(69171);function b({className:e,...s}){return(0,n.jsx)("div",{"data-slot":"skeleton",className:(0,j.cn)("animate-pulse rounded-md bg-muted",e),...s})}var v=t(77798),N=t(78971),y=t(92396);let w=e=>fetch(e).then(e=>e.json()),k=["chunking","embedding","upserting"];function C({open:e,onOpenChange:s,trigger:t}){let[x,m]=(0,l.useState)(!1),[g,p]=(0,l.useState)(!1),j=void 0!==e,z=j?e:g,S=j&&s?s:p,{data:I,isLoading:P,mutate:_}=(0,r.u)("/api/index",w,{refreshInterval:e=>e?.run&&k.includes(e.run.status)?1e3:0}),E=(0,l.useRef)(void 0);(0,l.useEffect)(()=>{let e=I?.run?.warning;e&&e!==E.current?v.oR.warning(e,{id:"rate-limit-warning",duration:7e4}):!e&&E.current&&(v.oR.dismiss("rate-limit-warning"),v.oR.success("Rate limit resolved — resuming indexing.",{duration:3e3})),E.current=e},[I?.run?.warning]);let[F,O]=(0,l.useState)(!1);async function R(e=!1){m(!0);try{let s=await fetch("/api/index",{method:"POST",body:JSON.stringify({incremental:e}),headers:{"Content-Type":"application/json"}}),t=await s.json();if(!s.ok)return void v.oR.error(t.error??"Could not start indexing.");v.oR.success("Indexing started."),_()}catch{v.oR.error("Could not start indexing.")}finally{m(!1)}}async function L(){m(!0);try{if(!(await fetch("/api/index",{method:"DELETE"})).ok)return void v.oR.error("Could not cancel indexing.");v.oR.success("Indexing cancelled."),_()}catch{v.oR.error("Could not cancel indexing.")}finally{m(!1)}}return(0,l.useEffect)(()=>{let e=I?.run?.status;e&&k.includes(e)?O(!0):F&&"completed"===e&&(O(!1),S(!1),v.oR.success("Indexing completed successfully!"))},[I?.run?.status,F,S]),(0,n.jsxs)(y.lG,{open:z,onOpenChange:S,children:[t?(0,n.jsx)(y.zM,{render:(0,l.isValidElement)(t)?t:(0,n.jsx)("button",{children:t})}):(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[I?.run?.status==="completed"&&(0,n.jsxs)(N.Lt,{children:[(0,n.jsx)(N.tv,{render:(0,n.jsxs)(h.$,{disabled:!I.ready||!!(I.run&&k.includes(I.run.status))||x,variant:"outline",children:[(0,n.jsx)(i.A,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,n.jsxs)(N.EO,{children:[(0,n.jsxs)(N.wd,{children:[(0,n.jsx)(N.r7,{children:"Are you sure you want to re-index data?"}),(0,n.jsx)(N.$v,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,n.jsxs)(N.ck,{children:[(0,n.jsx)(N.Zr,{children:"Cancel"}),(0,n.jsx)(N.Rx,{onClick:()=>{S(!0),R(!1)},children:"Continue"})]})]})]}),(0,n.jsx)(y.zM,{render:(0,n.jsxs)(h.$,{disabled:!I?.ready||I?.unindexedCount===0,children:[(0,n.jsx)(d.A,{className:"size-4 mr-2"}),"Index Data"]})})]}),(0,n.jsxs)(y.Cf,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,n.jsxs)(y.c7,{children:[(0,n.jsx)(y.L3,{children:"Index Data"}),(0,n.jsx)(y.rr,{children:"Chunk, embed, and index into your selected vector database."})]}),P||!I?(0,n.jsx)("div",{className:"py-6",children:(0,n.jsx)(b,{className:"h-40 w-full"})}):(0,n.jsxs)("div",{className:"space-y-6 py-4",children:[!I.ready&&(0,n.jsxs)(f.Fc,{variant:"default",children:[(0,n.jsx)(o.A,{className:"size-4 text-orange-500!"}),(0,n.jsx)(f.XL,{className:"text-orange-500!",children:"Not ready to index"}),(0,n.jsx)(f.TN,{children:(0,n.jsx)("ul",{className:"list-disc pl-4",children:I.blockers.map(e=>(0,n.jsx)("li",{children:e},e))})})]}),(0,n.jsx)(A,{run:I.run,running:!!(I.run&&k.includes(I.run.status))}),I.ready&&!I.run&&(0,n.jsxs)(f.Fc,{children:[(0,n.jsx)(c.A,{className:"size-4 text-blue-500!"}),(0,n.jsx)(f.XL,{className:"text-blue-600 dark:text-blue-400",children:"Before you start indexing"}),(0,n.jsxs)(f.TN,{className:"text-muted-foreground space-y-1",children:[(0,n.jsxs)("p",{children:["Once indexing begins, two settings become"," ",(0,n.jsx)("span",{className:"font-medium text-foreground",children:"locked"})," to the existing index:"]}),(0,n.jsxs)("ul",{className:"list-disc pl-4 space-y-0.5",children:[(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-foreground",children:"Embedding model"})," — you can swap to any model with the"," ",(0,n.jsx)("span",{className:"font-medium text-foreground",children:"same vector dimensions"}),", but switching to a model with different dimensions will require a full re-index."]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-foreground",children:"Vector store"})," — changing the store after indexing requires starting fresh."]})]})]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)(h.$,{onClick:()=>R(I.run?.status==="completed"),disabled:!I.ready||!!(I.run&&k.includes(I.run.status))||x||I.run?.status==="completed"&&0===I.unindexedCount,size:"lg",children:[I.run&&k.includes(I.run.status)||x?(0,n.jsx)(a.A,{className:"size-4 animate-spin mr-2"}):(0,n.jsx)(u.A,{className:"size-4 mr-2"}),I.run&&k.includes(I.run.status)?"Indexing…":x?"Starting…":I.run?.status==="completed"?`Index new documents (${I.unindexedCount})`:`Start indexing (${I.unindexedCount})`]}),I.run?.status==="completed"&&!(I.run&&k.includes(I.run.status))&&(0,n.jsxs)(N.Lt,{children:[(0,n.jsx)(N.tv,{render:(0,n.jsxs)(h.$,{variant:"outline",size:"lg",disabled:x,children:[(0,n.jsx)(i.A,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,n.jsxs)(N.EO,{children:[(0,n.jsxs)(N.wd,{children:[(0,n.jsx)(N.r7,{children:"Are you sure you want to re-index data?"}),(0,n.jsx)(N.$v,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,n.jsxs)(N.ck,{children:[(0,n.jsx)(N.Zr,{children:"Cancel"}),(0,n.jsx)(N.Rx,{onClick:()=>{S(!0),R(!1)},children:"Continue"})]})]})]}),!!(I.run&&k.includes(I.run.status))&&(0,n.jsx)(h.$,{onClick:L,disabled:x,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,n.jsx)(h.$,{variant:"ghost",size:"lg",onClick:()=>S(!1),children:"Close"})]})]})]})]})}let z={idle:{label:"Idle"},chunking:{label:"Chunking",phase:"Splitting documents into chunks"},embedding:{label:"Embedding",phase:"Generating vector embeddings"},upserting:{label:"Storing",phase:"Writing vectors to the store"},completed:{label:"Completed"},failed:{label:"Failed"}};function A({run:e,running:s}){if(!e)return(0,n.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground flex flex-col items-center justify-center gap-1 py-8 text-center",children:[(0,n.jsx)(x.A,{className:"mb-1 size-6 text-muted-foreground/60"}),(0,n.jsx)("p",{className:"text-sm font-medium",children:"No index built yet"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Build a Larkup index to embed your corpus and make it searchable."})]});let t=z[e.status],r=e.totalChunks>0?Math.round(e.processedChunks/e.totalChunks*100):5*!!s;return(0,n.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold",children:["completed"===e.status?(0,n.jsx)(m.A,{className:"size-4 text-primary"}):"failed"===e.status?(0,n.jsx)(o.A,{className:"size-4 text-destructive"}):(0,n.jsx)(a.A,{className:"size-4 animate-spin text-primary"}),t.label]}),(0,n.jsx)(I,{status:e.status})]}),"failed"===e.status?(0,n.jsx)(n.Fragment,{}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:t.phase??"Done"}),(0,n.jsxs)("span",{className:"font-mono tabular-nums",children:[e.processedChunks.toLocaleString(),e.totalChunks>0&&` / ${e.totalChunks.toLocaleString()}`," chunks"]})]}),(0,n.jsx)(g.ke,{value:r,className:"**:data-[slot=progress-indicator]:bg-green-600"})]}),(0,n.jsxs)("dl",{className:"grid grid-cols-2 gap-4 pt-1 sm:grid-cols-4",children:[(0,n.jsx)(S,{label:"Documents",value:e.docCount.toLocaleString()}),(0,n.jsx)(S,{label:"Chunks",value:e.totalChunks.toLocaleString()}),(0,n.jsx)(S,{label:"Dimensions",value:e.dimensions?e.dimensions.toLocaleString():"—"}),(0,n.jsx)(S,{label:"Duration",value:e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:s?"running…":"—"})]})]})]})}function S({label:e,value:s}){return(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("dt",{className:"text-xs text-muted-foreground",children:e}),(0,n.jsx)("dd",{className:"font-mono text-sm tabular-nums",children:s})]})}function I({status:e}){return"completed"===e?(0,n.jsx)(p.E,{className:"bg-primary/12 text-primary hover:bg-primary/12",children:"Ready"}):"failed"===e?(0,n.jsx)(p.E,{variant:"destructive",children:"Failed"}):k.includes(e)?(0,n.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-green-600",children:[(0,n.jsxs)("span",{className:"relative flex size-2",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-600 opacity-75"}),(0,n.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-600"})]}),"Live"]}):null}let P=e=>fetch(e).then(e=>e.json()),_=["chunking","embedding","upserting"];function E(){let{data:e}=(0,r.u)("/api/index",P,{refreshInterval:e=>e?.run&&_.includes(e.run.status)?1e3:0});if(!(e?.run&&_.includes(e.run.status))||!e?.run)return null;let{run:s}=e,t=s.totalChunks>0?Math.round(s.processedChunks/s.totalChunks*100):5;return(0,n.jsx)("div",{className:"fixed bottom-6 right-6 z-50",children:(0,n.jsx)(C,{trigger:(0,n.jsxs)("button",{className:"flex items-center gap-3 rounded-full border bg-background px-4 py-2 text-sm font-medium transition-all hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[(0,n.jsx)(a.A,{className:"size-4 animate-spin text-primary"}),(0,n.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,n.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:"Storing..."}),(0,n.jsxs)("span",{className:"leading-none",children:[t,"%"]})]})]})})})}},24406:(e,s,t)=>{Promise.resolve().then(t.t.bind(t,54168,23)),Promise.resolve().then(t.bind(t,73088)),Promise.resolve().then(t.bind(t,90744)),Promise.resolve().then(t.bind(t,19726)),Promise.resolve().then(t.bind(t,98911)),Promise.resolve().then(t.bind(t,57600)),Promise.resolve().then(t.bind(t,43063)),Promise.resolve().then(t.bind(t,52447)),Promise.resolve().then(t.bind(t,85088)),Promise.resolve().then(t.bind(t,45777))},43063:(e,s,t)=>{"use strict";t.d(s,{Toaster:()=>u});var n=t(6190),r=t(45777),a=t(77798),l=t(26912),i=t(23027),d=t(66290),o=t(86124),c=t(34321);let u=({...e})=>{let{theme:s="system"}=(0,r.D)();return(0,n.jsx)(a.l$,{closeButton:!0,theme:s,className:"toaster group z-9999999! ",icons:{success:(0,n.jsx)(l.A,{className:"size-5 text-white",fill:"#10b981"}),info:(0,n.jsx)(i.A,{className:"size-5 text-white",fill:"#3b82f6"}),warning:(0,n.jsx)(d.A,{className:"size-5 text-white",fill:"#f59e0b"}),error:(0,n.jsx)(o.A,{className:"size-5 text-white",fill:"#ef4444"}),loading:(0,n.jsx)(c.A,{className:"size-5 animate-spin text-muted-foreground"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)",zIndex:999999},toastOptions:{classNames:{toast:"group toast items-start group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:",icon:"mt-0.5",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",success:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",error:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",warning:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",info:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900"}},...e})}},52447:(e,s,t)=>{"use strict";t.d(s,{UpdateBanner:()=>m});var n=t(6190),r=t(47614),a=t(40124),l=t(76447),i=t(9048),d=t(6551),o=t(87172),c=t(78942);let u="larkup-update-dismissed",x={docker:"docker compose pull && docker compose up -d",npm:"larkup update"};function m(){let[e,s]=(0,r.useState)(null),[m,h]=(0,r.useState)(!1),[g,p]=(0,r.useState)(!1),[f,j]=(0,r.useState)(!1),b="0.2.7",v="__TAURI__"in window?"desktop":"true"===c.env.NEXT_PUBLIC_DOCKER_ENV||"true"===c.env.NEXT_PUBLIC_RUNNING_IN_DOCKER?"docker":"npm";(0,r.useEffect)(()=>{if(function(){try{let e=localStorage.getItem(u);if(!e)return!1;let{timestamp:s}=JSON.parse(e);return Date.now()-s<864e5}catch{return!1}}())return;let e=new AbortController;return fetch("https://www.larkup.de/api/version",{signal:e.signal,cache:"no-store"}).then(e=>e.json()).then(e=>{e.version&&function(e,s){let t=e.replace(/^v/,"").split(".").map(Number),n=s.replace(/^v/,"").split(".").map(Number);for(let e=0;e<3;e++){let s=t[e]||0,r=n[e]||0;if(s>r)return 1;if(s<r)return -1}return 0}(e.version,b)>0&&(s(e.version),h(!0))}).catch(()=>{}),()=>e.abort()},[b]);let N=async()=>{if("desktop"===v){p(!0);try{let{check:e}=await t.e(4530).then(t.bind(t,64530)),{relaunch:s}=await t.e(4058).then(t.bind(t,74058)),n=await e();n?(await n.downloadAndInstall(),await s()):p(!1)}catch(e){console.error("Auto-update failed:",e),p(!1),window.open("https://www.larkup.de/download","_blank")}}else try{await navigator.clipboard.writeText(x[v]),j(!0),window.setTimeout(()=>j(!1),2e3)}catch(e){console.error("Could not copy update command:",e)}};return m&&e?(0,n.jsx)("div",{role:"status","aria-live":"polite",className:"relative z-50 border-b border-border bg-background px-3 py-2 text-foreground sm:px-4",children:(0,n.jsxs)("div",{className:"mx-auto flex min-h-7 max-w-screen-2xl items-center gap-2.5",children:[(0,n.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background",children:(0,n.jsx)(a.A,{className:"size-3.5","aria-hidden":"true"})}),(0,n.jsxs)("p",{className:"min-w-0 text-xs sm:text-sm",children:[(0,n.jsxs)("span",{className:"font-medium",children:["Larkup v",e," is available."]})," ",(0,n.jsxs)("span",{className:"hidden text-muted-foreground sm:inline",children:["You're using v",b,"."]})]}),"desktop"!==v&&(0,n.jsx)("code",{className:"ml-auto hidden max-w-152 truncate rounded-[5px] border border-border bg-muted/40 px-2 py-1 font-mono text-[11px] text-muted-foreground lg:block",children:x[v]}),(0,n.jsx)(o.$,{type:"button",variant:"desktop"===v?"default":"outline",size:"xs",onClick:N,disabled:g,"aria-label":"desktop"===v?"Update Larkup now":"Copy update command",className:"desktop"===v?"ml-auto":"ml-auto lg:ml-0",children:"desktop"===v?g?"Updating...":"Update now":f?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{"aria-hidden":"true"}),"Copied"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.A,{"aria-hidden":"true"}),"Copy command"]})}),(0,n.jsx)(o.$,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>{try{localStorage.setItem(u,JSON.stringify({timestamp:Date.now()}))}catch{}h(!1)},"aria-label":"Dismiss update notification",title:"Remind me tomorrow",children:(0,n.jsx)(d.A,{"aria-hidden":"true"})})]})}):null}},54168:()=>{},62921:(e,s,t)=>{"use strict";t.d(s,{ke:()=>d});var n=t(6190),r=t(97611),a=t(38131),l=t(34847),i=t(69171);function d({className:e,children:s,value:t,...a}){return(0,n.jsxs)(r.w,{value:t,"data-slot":"progress",className:(0,i.cn)("flex flex-wrap gap-3",e),...a,children:[s,(0,n.jsx)(o,{children:(0,n.jsx)(c,{})})]})}function o({className:e,...s}){return(0,n.jsx)(a.X,{className:(0,i.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",e),"data-slot":"progress-track",...s})}function c({className:e,...s}){return(0,n.jsx)(l.Z,{"data-slot":"progress-indicator",className:(0,i.cn)("h-full bg-primary transition-all",e),...s})}},73088:(e,s,t)=>{"use strict";t.d(s,{GpuActivityIndicator:()=>d});var n=t(6190),r=t(92390),a=t(99483);let l=e=>fetch(e).then(e=>e.json());function i({percent:e}){let s=2*Math.PI*14,t=Math.max(0,Math.min(100,e));return(0,n.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",className:"shrink-0 -rotate-90",children:[(0,n.jsx)("circle",{cx:"16",cy:"16",r:14,className:"stroke-emerald-500/20",strokeWidth:"3",fill:"none"}),(0,n.jsx)("circle",{cx:"16",cy:"16",r:14,className:"stroke-emerald-500 transition-[stroke-dashoffset] duration-500",strokeWidth:"3",fill:"none",strokeLinecap:"round",strokeDasharray:s,strokeDashoffset:s-t/100*s})]})}function d(){let{data:e}=(0,a.u)("/api/gpu-activity",l,{refreshInterval:e=>e?.activity?.phase==="waking-up"?1e3:4e3}),s=e?.activity;return!s||"waking-up"!==s.phase||s.toolCallId?null:(0,n.jsx)("div",{className:"fixed bottom-24 right-6 z-50",children:(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border bg-white dark:bg-background px-3 py-2 text-sm font-medium shadow-xs",children:[(0,n.jsx)(i,{percent:s.percent}),(0,n.jsxs)("div",{className:"flex flex-col items-start gap-0.5 pr-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(r.A,{className:"size-4"}),(0,n.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:s.label})]}),(0,n.jsx)("span",{className:"larkup-shimmer-text leading-none",children:s.message}),(0,n.jsxs)("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(s.percent),"%"]})]})]})})}},90744:(e,s,t)=>{"use strict";t.d(s,{ClientLayoutWrapper:()=>V});var n=t(6190),r=t(57600),a=t(47614),l=t(11785),i=t.n(l),d=t(55354),o=t(82893),c=t(2071),u=t(584),x=t(82264),m=t(69826),h=t(65155),g=t(69171),p=t(5629),f=t(41864),j=t(76447),b=t(74688),v=t(80064),N=t(73977),y=t(98911),w=t(77159),k=t(77798),C=t(34321),z=t(87172),A=t(92396);function S({target:e,open:s,onOpenChange:t}){let{deleteProject:r}=(0,y.B)(),[l,i]=(0,a.useState)(!1);async function d(){if(e){i(!0);try{await r(e.id),k.oR.success(`Deleted "${e.name}".`),t(!1)}catch{k.oR.error("Could not delete the Project.")}finally{i(!1)}}}return(0,n.jsx)(A.lG,{open:s,onOpenChange:t,children:(0,n.jsxs)(A.Cf,{className:"sm:max-w-md",children:[(0,n.jsxs)(A.c7,{children:[(0,n.jsxs)(A.L3,{children:["Delete “",e?.name,"”?"]}),(0,n.jsx)(A.rr,{children:"This permanently removes the Project's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,n.jsxs)(A.Es,{children:[(0,n.jsx)(z.$,{variant:"outline",onClick:()=>t(!1),disabled:l,children:"Cancel"}),(0,n.jsxs)(z.$,{variant:"destructive",onClick:()=>void d(),disabled:l,children:[l&&(0,n.jsx)(C.A,{className:"size-4 animate-spin"}),"Delete Project"]})]})]})})}function I(){let{projects:e,activeProject:s,activateProject:t}=(0,y.B)(),[r,l]=(0,a.useState)(!1),[i,d]=(0,a.useState)(null),[o,u]=(0,a.useState)(null);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(N.rI,{children:[(0,n.jsxs)(N.ty,{render:(0,n.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-lg border border-border bg-card px-2 py-1.5 text-left transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),children:[(0,n.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:(0,n.jsx)(h.A,{className:"size-3.5"})}),(0,n.jsx)("span",{className:"flex min-w-0 flex-1 flex-col",children:(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:s?.name??"No project"}),s?.running&&(0,n.jsx)(P,{})]})}),(0,n.jsx)(f.A,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,n.jsxs)(N.SQ,{align:"start",sideOffset:6,className:"w-(--anchor-width) min-w-65",children:[(0,n.jsxs)(N.I,{children:[(0,n.jsx)(N.lp,{children:"Your projects"}),e.map(e=>{let r=e.id===s?.id;return(0,n.jsxs)(N._2,{onClick:()=>{r||t(e.id)},className:"gap-2",children:[(0,n.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,n.jsx)(h.A,{className:"size-3.5"})}),(0,n.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,n.jsxs)("span",{className:"flex items-center gap-2 text-[11px] text-muted-foreground tabular-nums",children:[(0,n.jsxs)("span",{children:[e.sourceCount," sources"]}),e.indexed&&(0,n.jsx)("span",{children:"\xb7 indexed"}),e.running&&(0,n.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,n.jsx)(P,{}),"live"]})]})]}),r&&(0,n.jsx)(j.A,{className:"size-4 shrink-0 text-primary"})]},e.id)})]}),(0,n.jsx)(N.mB,{}),(0,n.jsxs)(N._2,{onClick:()=>l(!0),className:"gap-2 h-9",children:[(0,n.jsx)(c.A,{className:"size-4"}),"New project"]}),s&&(0,n.jsxs)(N._2,{onClick:()=>d(s),className:"gap-2 h-9",children:[(0,n.jsx)(b.A,{className:"size-4"}),"Rename current"]}),s&&e.length>1&&(0,n.jsxs)(N._2,{variant:"destructive",onClick:()=>u(s),className:"gap-2",children:[(0,n.jsx)(v.A,{className:"size-4"}),"Delete current project"]})]})]}),(0,n.jsx)(w.S,{mode:"create",open:r,onOpenChange:l}),(0,n.jsx)(w.S,{mode:"rename",target:i,open:null!==i,onOpenChange:e=>!e&&d(null)}),(0,n.jsx)(S,{target:o,open:null!==o,onOpenChange:e=>!e&&u(null)})]})}function P(){return(0,n.jsxs)("span",{className:"relative flex size-2",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,n.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-500"})]})}let _=[{id:"chat",label:"Chat",href:"/chat",icon:o.A},{id:"add",label:"Add",href:"/add",icon:c.A},{id:"data",label:"Data",href:"/data",icon:u.A},{id:"settings",label:"Settings",href:"/settings",icon:x.A}];function E(){let e=(0,d.usePathname)(),{activeProject:s}=(0,y.B)(),[t,r]=(0,a.useState)(!0);(0,a.useEffect)(()=>{"false"===localStorage.getItem("sidebar-collapsed")&&r(!1)},[]);let l=()=>{let e=!t;r(e),localStorage.setItem("sidebar-collapsed",String(e))};return(0,n.jsx)(p.Bc,{delay:150,children:(0,n.jsxs)("aside",{className:(0,g.cn)("sticky top-0 hidden h-screen shrink-0 flex-col self-start py-4 md:flex transition-all duration-300 ease-in-out bg-sidebar",t?"w-18":"w-60"),children:[(0,n.jsx)("div",{className:(0,g.cn)("flex w-full items-center mb-6",t?"justify-center px-3":"justify-between px-4"),children:t?(0,n.jsxs)(p.m_,{children:[(0,n.jsxs)(p.k$,{render:(0,n.jsx)("button",{onClick:l,"aria-label":"Expand sidebar",className:"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105"}),children:[(0,n.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,n.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,n.jsx)(p.ZI,{side:"right",sideOffset:10,children:"Expand sidebar"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i(),{href:"/chat",className:"flex items-center gap-2.5",children:[(0,n.jsxs)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:[(0,n.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,n.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,n.jsx)("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Larkup"})]}),(0,n.jsx)("button",{onClick:l,className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors","aria-label":"Collapse sidebar",children:(0,n.jsx)(m.A,{className:"size-3.5"})})]})}),(0,n.jsx)("nav",{className:(0,g.cn)("flex flex-1 flex-col w-full",t?"items-center px-3 gap-3":"px-3 gap-1.5"),children:_.map(s=>{let r=s.icon,a=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return t?(0,n.jsxs)(p.m_,{children:[(0,n.jsx)(p.k$,{className:"",render:(0,n.jsx)(i(),{href:s.href,"aria-current":a?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,g.cn)("group relative flex size-10 items-center justify-center rounded-xl transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",a?"bg-sidebar-accent/60 text-sidebar-accent-foreground hover:bg-sidebar-accent":"text-muted-foreground hover:bg-white/65 hover:text-foreground")}),children:(0,n.jsx)(r,{className:"size-4.5",strokeWidth:a?2.25:1.75})}),(0,n.jsx)(p.ZI,{side:"right",sideOffset:10,children:s.label})]},s.id):(0,n.jsxs)(i(),{href:s.href,"aria-current":a?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,g.cn)("group relative flex items-center gap-3 rounded-xl px-3 py-2.5 text-[13px] font-medium transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",a?"bg-sidebar-accent/70 text-sidebar-accent-foreground hover:bg-sidebar-accent/70":"text-muted-foreground hover:bg-white/65 hover:text-foreground"),children:[(0,n.jsx)(r,{className:"size-4.5 shrink-0",strokeWidth:a?2.25:1.75}),(0,n.jsx)("span",{className:"truncate",children:s.label})]},s.id)})}),(0,n.jsx)("div",{className:(0,g.cn)("w-full pt-3",t?"px-2":"px-3"),children:t?(0,n.jsxs)(p.m_,{children:[(0,n.jsx)(p.k$,{render:(0,n.jsx)("button",{onClick:l,className:"flex w-full items-center justify-center py-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors"}),children:(0,n.jsxs)("div",{className:"relative size-8 rounded-lg border border-border bg-card flex items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:[(0,n.jsx)(h.A,{className:"size-4"}),(0,n.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-2.5",children:s?.running?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,n.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-green-500 border border-card"})]}):(0,n.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-gray-500 border border-card"})})]})}),(0,n.jsxs)(p.ZI,{side:"right",sideOffset:10,children:[s?.name??"No project"," (",s?.running?"Live":"Offline",")"]})]}):(0,n.jsx)(I,{})})]})})}let F=[{id:"chat",label:"Chat",href:"/chat",icon:o.A},{id:"add",label:"Add",href:"/add",icon:c.A},{id:"data",label:"Data",href:"/data",icon:u.A},{id:"settings",label:"Settings",href:"/settings",icon:x.A}];function O(){let e=(0,d.usePathname)();return(0,n.jsx)(p.Bc,{delay:150,children:(0,n.jsxs)("header",{className:(0,g.cn)("sticky top-0 z-50 flex h-14 shrink-0 items-center gap-6 border-b border-border px-4 md:px-6 bg-sidebar"),children:[(0,n.jsxs)(i(),{href:"/chat","aria-label":"larkup home",className:"flex items-center gap-2.5 shrink-0",children:[(0,n.jsxs)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:[(0,n.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,n.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,n.jsx)("span",{className:"font-semibold tracking-tight text-foreground hidden sm:inline-block",children:"Larkup"})]}),(0,n.jsx)("nav",{className:"flex h-full items-center gap-1",children:F.map(s=>{let t=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return(0,n.jsxs)(i(),{href:s.href,"aria-current":r?"page":void 0,className:(0,g.cn)("group relative flex items-center gap-2 h-full px-3 text-[13px] font-medium transition-colors outline-none",r?"text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsx)(t,{className:"size-4",strokeWidth:r?2.25:1.75}),(0,n.jsx)("span",{className:"hidden md:inline",children:s.label}),(0,n.jsx)("span",{className:(0,g.cn)("absolute bottom-0 left-2 right-2 h-0.5 rounded-full bg-primary transition-opacity",r?"opacity-100":"opacity-0")})]},s.id)})}),(0,n.jsx)("div",{className:"flex-1"}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(I,{}),""]})]})})}var R=t(15704),L=t(80976),B=t(57930),M=t(56513),$=t(83397),D=t(60856),K=t(11700),T=t(62779),Q=t(17749);let U=["vercel_ai_gateway","openai","google","mistral","custom"];function W(){let{createProject:e,refresh:s}=(0,y.B)(),t=(0,d.useRouter)(),[r,l]=(0,a.useState)(""),[i,o]=(0,a.useState)("vercel_ai_gateway"),[c,u]=(0,a.useState)(""),[x,m]=(0,a.useState)(null),[h,g]=(0,a.useState)("vercel_ai_gateway"),[p,f]=(0,a.useState)(""),[j,v]=(0,a.useState)(null),[N,w]=(0,a.useState)(!1),[S,I]=(0,a.useState)(!1),[P,_]=(0,a.useState)(!1),[E,F]=(0,a.useState)("vercel_ai_gateway"),[O,W]=(0,a.useState)(""),[V,G]=(0,a.useState)(!1),[Z,J]=(0,a.useState)(!1),[X,q]=(0,a.useState)(!1),[H,Y]=(0,a.useState)(null),ee="custom"===i,es="custom"===h,et=S||ee||i!==h?p:c,en=async()=>{w(!0);try{let n=await fetch("/api/config"),{config:a}=await n.json(),l={...a};ee&&x?(l.embeddingProvider="custom",l.embeddingModelId=`custom:${x.modelName}`,l.embeddingApiKey=x.apiKey||void 0,l.customEmbeddings=[x]):(l.embeddingProvider=i,l.embeddingApiKey=c),S?es&&j?(l.chatProvider="custom",l.chatModelId=`custom:${j.modelName}`,l.chatApiKey=j.apiKey||void 0,l.customChatModels=[j]):(l.chatProvider=h,l.chatApiKey=et):ee&&x||(l.chatProvider=i,l.chatApiKey=c),l.visionProvider=P?E:l.chatProvider,l.visionApiKey=P?O:l.chatApiKey,l.visionModelId="";let d=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeddingProvider:l.embeddingProvider,embeddingApiKey:l.embeddingApiKey,embeddingModelId:l.embeddingModelId,customEmbeddings:l.customEmbeddings,chatProvider:l.chatProvider,chatApiKey:l.chatApiKey,chatModelId:l.chatModelId,customChatModels:l.customChatModels,visionProvider:l.visionProvider,visionApiKey:l.visionApiKey,visionModelId:l.visionModelId})});if(!d.ok){let e=await d.json();k.oR.error(e.error||"Verification failed — please check your API key.",{duration:8e3}),w(!1);return}await e(r.trim()||"my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),s(),t.push("/chat")}catch(e){k.oR.error("Failed to complete setup")}finally{w(!1)}},er=async()=>{w(!0);try{await e(r.trim()||"my-larkup"),s(),t.push("/chat")}catch(e){k.oR.error("Failed to complete setup")}finally{w(!1)}},ea=(e,s)=>(0,n.jsxs)(K.l6,{value:e,onValueChange:e=>{var t;"custom"===(t=e??"")?("embedding"===s?o("custom"):g("custom"),Y(s)):"embedding"===s?(o(t),m(null),!S&&g(t),!P&&F(t)):(g(t),v(null))},children:[(0,n.jsx)(K.bq,{className:"w-full bg-white/90 hover:bg-white",children:(0,n.jsx)("span",{className:"flex items-center gap-2",children:T.Qd[e]?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(T.rb,{src:T.Qd[e].iconSrc,alt:T.Qd[e].label,pillBg:T.Qd[e].pillBg,size:16}),T.Qd[e].label]}):"Select provider"})}),(0,n.jsx)(K.gC,{children:U.map(e=>{let s=T.Qd[e];return s?(0,n.jsx)(K.eb,{value:e,children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(T.rb,{src:s.iconSrc,alt:s.label,pillBg:s.pillBg,size:16}),(0,n.jsxs)("span",{children:[s.label,"vercel_ai_gateway"===e&&" (Recommended)","custom"===e&&" (OpenAI-compatible)"]})]})},e):null})})]}),el=(e,s)=>(0,n.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 rounded-lg border border-green-200 bg-green-50/50 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-green-600 text-xs",children:"✓"}),(0,n.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-foreground",children:e.modelName}),(0,n.jsx)("button",{type:"button",onClick:()=>Y(s),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,n.jsx)(b.A,{className:"size-3"})})]});return(0,n.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-background",children:[(0,n.jsxs)("div",{className:"pointer-events-none fixed inset-0 overflow-hidden",children:[(0,n.jsx)("div",{className:"absolute -left-20 -top-20 h-125 w-125 rounded-full bg-stone-200/40 blur-3xl animate-pulse"}),(0,n.jsx)("div",{className:"absolute -bottom-32 -right-32 h-150 w-150 rounded-full bg-amber-100/30 blur-3xl animate-pulse [animation-delay:1s]"})]}),(0,n.jsx)("div",{className:"relative z-10 flex min-h-full w-full flex-col items-center justify-center px-6 py-12",children:(0,n.jsxs)("div",{className:"flex w-full max-w-lg flex-col items-center gap-8 animate-fade-up",children:[(0,n.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,n.jsx)("div",{className:"flex size-14 items-center justify-center rounded-xl bg-primary text-primary-foreground ",children:(0,n.jsx)("img",{src:"/logo9.png",className:"size-8",alt:"Larkup"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome to Larkup"}),(0,n.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Let's set up your AI models. You can change these later in Settings."})]})]}),(0,n.jsxs)("div",{className:"w-full space-y-5 rounded-2xl p-6 backdrop-blur-xl",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Your Name (Optional)"}),(0,n.jsx)(D.p,{value:r,onChange:e=>l(e.target.value),placeholder:"How should we call you?",className:"bg-white"})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Embedding Provider"}),ea(i,"embedding"),ee&&x&&el(x,"embedding"),ee&&!x&&(0,n.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!ee&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("label",{className:"text-xs font-medium text-foreground",children:["API Key",!S&&(0,n.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(used for both embedding & chat)"]})]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(D.p,{type:V?"text":"password",value:c,onChange:e=>u(e.target.value),placeholder:"sk-...",className:"bg-white pr-10"}),(0,n.jsx)("button",{type:"button","aria-label":V?"Hide API key":"Show API key",onClick:()=>G(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:V?(0,n.jsx)(R.A,{className:"size-4"}):(0,n.jsx)(L.A,{className:"size-4"})})]})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>I(!S),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[S?(0,n.jsx)(B.A,{className:"size-3.5"}):(0,n.jsx)(M.A,{className:"size-3.5"}),"Use a different chat model"]}),S&&(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat Provider"}),ea(h,"chat"),es&&j&&el(j,"chat"),es&&!j&&(0,n.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!es&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat API Key"}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(D.p,{type:Z?"text":"password",value:p,onChange:e=>f(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,n.jsx)("button",{type:"button","aria-label":Z?"Hide chat API key":"Show chat API key",onClick:()=>J(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:Z?(0,n.jsx)(R.A,{className:"size-4"}):(0,n.jsx)(L.A,{className:"size-4"})})]})]})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>_(!P),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[P?(0,n.jsx)(B.A,{className:"size-3.5"}):(0,n.jsx)(M.A,{className:"size-3.5"}),"Use a dedicated vision model for video and images"]}),P&&(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Vision Provider"}),(0,n.jsxs)(K.l6,{value:E,onValueChange:e=>F(e??""),children:[(0,n.jsx)(K.bq,{className:"w-full bg-white/90 hover:bg-white",children:(0,n.jsx)("span",{className:"flex items-center gap-2",children:T.Qd[E]?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(T.rb,{src:T.Qd[E].iconSrc,alt:T.Qd[E].label,pillBg:T.Qd[E].pillBg,size:16}),T.Qd[E].label]}):"Select provider"})}),(0,n.jsx)(K.gC,{children:U.filter(e=>"custom"!==e).map(e=>{let s=T.Qd[e];return s?(0,n.jsx)(K.eb,{value:e,children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(T.rb,{src:s.iconSrc,alt:s.label,pillBg:s.pillBg,size:16}),(0,n.jsx)("span",{children:s.label})]})},e):null})})]}),(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Only vision-capable models are used; the default is selected automatically."})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Vision API Key"}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(D.p,{type:X?"text":"password",value:O,onChange:e=>W(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,n.jsx)("button",{type:"button","aria-label":X?"Hide vision API key":"Show vision API key",onClick:()=>q(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:X?(0,n.jsx)(R.A,{className:"size-4"}):(0,n.jsx)(L.A,{className:"size-4"})})]})]})]}),(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"More providers and fine-grained model selection available in Settings → AI Models."}),(0,n.jsxs)("div",{className:"pt-2 flex gap-3",children:[(0,n.jsx)(z.$,{variant:"outline",className:"flex-1 h-10",onClick:er,disabled:N,children:"Skip for now"}),(0,n.jsx)(z.$,{className:"flex-1 h-10",onClick:en,disabled:N||!(()=>{if(ee){if(!x)return!1}else if(!c)return!1;if(S){if(es){if(!j)return!1}else if(!et)return!1}return!P||!!O})(),children:N?(0,n.jsx)(C.A,{className:"size-4 animate-spin"}):(0,n.jsxs)(n.Fragment,{children:["Continue ",(0,n.jsx)($.A,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,n.jsx)(A.lG,{open:null!==H,onOpenChange:e=>{e||("embedding"!==H||x||o("vercel_ai_gateway"),"chat"!==H||j||g("vercel_ai_gateway"),Y(null))},children:(0,n.jsxs)(A.Cf,{className:"max-w-xl",children:[(0,n.jsxs)(A.c7,{children:[(0,n.jsxs)(A.L3,{children:["Custom ","embedding"===H?"Embedding":"Chat"," Model"]}),(0,n.jsxs)(A.rr,{children:["Connect an OpenAI-compatible ","embedding"===H?"embedding":"chat"," ","model. Test the connection before adding."]})]}),H&&(0,n.jsx)(Q.B,{type:H,onSave:e=>{"embedding"===H?(m(e),o("custom")):"chat"===H&&(v(e),g("custom")),Y(null)},onCancel:()=>{"embedding"!==H||x||o("vercel_ai_gateway"),"chat"!==H||j||g("vercel_ai_gateway"),Y(null)}})]})})]})}function V({children:e}){let{layout:s}=(0,r.y)(),t=(0,d.usePathname)(),a=t?.includes("/chat"),{isFirstRun:l,isLoading:i}=(0,y.B)();return!i&&l?(0,n.jsx)(W,{}):i?(0,n.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,n.jsx)("div",{className:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):"topnav"===s?(0,n.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",children:[(0,n.jsx)(O,{}),(0,n.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,n.jsx)("div",{className:"h-full flex flex-col bg-background text-foreground",children:(0,n.jsx)("div",{className:(0,g.cn)("flex-1 min-h-0",a||t?.includes("/settings")||t?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,n.jsx)("div",{className:(0,g.cn)("h-full w-full",a||t?.includes("/settings")||t?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]}):(0,n.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,n.jsx)(E,{}),(0,n.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,n.jsx)("div",{className:"h-screen flex flex-col border-l border-border/90 bg-background text-foreground overflow-hidden",children:(0,n.jsx)("div",{className:(0,g.cn)("flex-1 min-h-0",a||t?.includes("/settings")||t?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,n.jsx)("div",{className:(0,g.cn)("h-full w-full",a||t?.includes("/settings")||t?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]})}}},e=>{e.O(0,[3977,2852,9775,9742,3485,2109,3623,4439,5307,876,7358],()=>e(e.s=24406)),_N_E=e.O()}]);
|
|
File without changes
|
|
File without changes
|