Skip to content

Commit 813f83f

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 813f83f

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
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 {

data/products.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ telegraf:
235235
latest_patches:
236236
v1: 1.36.3
237237
ai_sample_questions:
238-
- How do I install and configure Telegraf?
238+
- How do I configure Telegraf for InfluxDB 3?
239239
- How do I write a custom Telegraf plugin?
240240
- How do I use Telegraf for MQTT?
241241

0 commit comments

Comments
 (0)