feat: US-014 - Update to Gemini 3 Flash Preview with model indicator
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
isGeminiAvailable,
|
isGeminiAvailable,
|
||||||
parseItemIds,
|
parseItemIds,
|
||||||
stripItemsSuffix,
|
stripItemsSuffix,
|
||||||
|
GEMINI_DISPLAY_NAME,
|
||||||
type ChatMessage,
|
type ChatMessage,
|
||||||
} from '@/lib/gemini'
|
} from '@/lib/gemini'
|
||||||
import { buildPaletteData } from '@/lib/search'
|
import { buildPaletteData } from '@/lib/search'
|
||||||
@@ -246,6 +247,7 @@ export function ChatWidget({ onAction }: ChatWidgetProps) {
|
|||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'baseline', gap: '8px' }}>
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
@@ -255,6 +257,16 @@ export function ChatWidget({ onAction }: ChatWidgetProps) {
|
|||||||
>
|
>
|
||||||
Ask about Andy
|
Ask about Andy
|
||||||
</span>
|
</span>
|
||||||
|
<span
|
||||||
|
className="font-geist"
|
||||||
|
style={{
|
||||||
|
fontSize: '11px',
|
||||||
|
color: 'var(--text-tertiary)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{GEMINI_DISPLAY_NAME}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsOpen(false)}
|
onClick={() => setIsOpen(false)}
|
||||||
aria-label="Close chat"
|
aria-label="Close chat"
|
||||||
|
|||||||
+17
-11
@@ -5,7 +5,10 @@ export interface ChatMessage {
|
|||||||
content: string
|
content: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const GEMINI_API_BASE = 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash'
|
export const GEMINI_MODEL = 'gemini-3-flash-preview'
|
||||||
|
export const GEMINI_DISPLAY_NAME = 'Gemini 3 Flash'
|
||||||
|
|
||||||
|
const GEMINI_API_BASE = `https://generativelanguage.googleapis.com/v1beta/models/${GEMINI_MODEL}`
|
||||||
|
|
||||||
function getApiKey(): string | undefined {
|
function getApiKey(): string | undefined {
|
||||||
return import.meta.env.VITE_GEMINI_API_KEY as string | undefined
|
return import.meta.env.VITE_GEMINI_API_KEY as string | undefined
|
||||||
@@ -19,20 +22,23 @@ function buildSystemPrompt(): string {
|
|||||||
const texts = buildEmbeddingTexts()
|
const texts = buildEmbeddingTexts()
|
||||||
const cvContent = texts.map((t) => `- ${t.text}`).join('\n')
|
const cvContent = texts.map((t) => `- ${t.text}`).join('\n')
|
||||||
|
|
||||||
return `You are an AI assistant embedded in Andy Charlwood's professional portfolio website. Your role is to answer questions about Andy's professional experience, skills, projects, and qualifications accurately and concisely.
|
return `You are an AI assistant on Andy Charlwood's portfolio website. Answer questions about his experience, skills, projects, and qualifications.
|
||||||
|
|
||||||
Here is Andy's complete professional profile:
|
## Andy's Professional Profile
|
||||||
|
|
||||||
${cvContent}
|
${cvContent}
|
||||||
|
|
||||||
Instructions:
|
## Rules
|
||||||
- Answer questions based ONLY on the information above. Do not invent roles, dates, or achievements.
|
1. Use ONLY the profile above. Never invent roles, dates, or achievements.
|
||||||
- Be concise — 2-4 sentences for most answers.
|
2. Be concise (2-4 sentences). Be professional but friendly.
|
||||||
- Be professional but friendly in tone.
|
3. If the information isn't in the profile, say so.
|
||||||
- If asked something not covered by the profile data, say you don't have that information.
|
|
||||||
- At the end of your response, on a new line, include relevant portfolio item IDs in this format: [ITEMS: id1, id2, id3]
|
## Item References
|
||||||
- Only include item IDs that are directly relevant to your answer. The available IDs are the ones listed above (e.g., exp-*, skill-*, proj-*, ach-*, edu-*, action-*).
|
After your answer, on a NEW line, list relevant portfolio item IDs:
|
||||||
- If no items are particularly relevant, omit the [ITEMS: ...] line entirely.`
|
[ITEMS: id1, id2, id3]
|
||||||
|
- IDs match the profile entries above (exp-*, skill-*, proj-*, ach-*, edu-*, action-*).
|
||||||
|
- Only include IDs directly relevant to your answer.
|
||||||
|
- If no items are relevant, omit the [ITEMS: ...] line entirely.`
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildRequestBody(
|
function buildRequestBody(
|
||||||
|
|||||||
Reference in New Issue
Block a user