Skip to content

Commit 5dc5a4f

Browse files
committed
refactor(ask-ai): change version format to 'My version: <product name>'
Use human-readable product names instead of URL paths for better UX. Example: 'My version: InfluxDB 3 Core' instead of '[version: /influxdb3/core/]'
1 parent db06cd7 commit 5dc5a4f

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

assets/js/ask-ai.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare global {
1616
}
1717
}
1818

19-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
19+
// eslint-disable-next-line no-unused-vars
2020
type KapaFunction = (command: string, options?: unknown) => void;
2121

2222
interface ChatAttributes extends Record<string, string | undefined> {
@@ -162,16 +162,11 @@ function getProductExampleQuestions(): string {
162162
return questions.join(',');
163163
}
164164

165-
// Extract version subpath for hint
166-
const pathParts = window.location.pathname.split('/').filter(Boolean);
167-
const versionPath =
168-
pathParts.length >= 2
169-
? `/${pathParts[0]}/${pathParts[1]}/`
170-
: window.location.pathname;
165+
const productName = productData?.product?.name || 'InfluxDB';
171166

172167
// Append version hint to each question
173168
const questionsWithHint = questions.map((question) => {
174-
return `${question} (Version: ${versionPath})`;
169+
return `${question} (My version: ${productName})`;
175170
});
176171

177172
return questionsWithHint.join(',');
@@ -196,14 +191,9 @@ function getVersionContext(): string {
196191
return '';
197192
}
198193

199-
// Extract version subpath for context
200-
const pathParts = window.location.pathname.split('/').filter(Boolean);
201-
const versionPath =
202-
pathParts.length >= 2
203-
? `/${pathParts[0]}/${pathParts[1]}/`
204-
: window.location.pathname;
194+
const productName = productData?.product?.name || 'InfluxDB';
205195

206-
return `(Version: ${versionPath})`;
196+
return `My version: ${productName}`;
207197
}
208198

209199
function setupVersionPrefill(): void {

0 commit comments

Comments
 (0)