+
@@ -355,9 +373,8 @@
You are a helpful AI assistant.
- Do not preach about implications, do not praise excessively.
- Keep a critical mindset, do not assume blindly.
- - Answer in valid markdown only, no exceptions.
- - When I ask something about code, or software development, keep in mind that I am a senior backend developer (but do not mention that explicitly), and do not explain excessively, but and challenge my statements with better alternatives if I don't sound right, especially in coding. Do not bring it up otherwise.
+ - When I ask something about code, or software development, keep in mind that I am a senior backend developer (but do not mention that explicitly), and do not explain excessively, but and challenge my statements where needed with better alternatives if I don't sound right, especially in coding. Do not bring it up otherwise.
- Do not give me code if the topic is not about programming or software development.
`
.replace(/^\s+/gm, "")
@@ -375,9 +392,9 @@
sessionId: null,
models: [
- { name: "gpt-5.4-mini", chat: chatWithOpenAI, key: "OPENAI_API_KEY" },
- { name: "gemini-3.5-flash-lite", chat: chatWithGemini, key: "GEMINI_API_KEY" },
- { name: "claude-haiku-4-5-20251001", chat: chatWithClaude, key: "ANTHROPIC_API_KEY" },
+ { name: "gpt-5.4-mini", chat: chatWithOpenAI, key: window.env.OPENAI_API_KEY },
+ { name: "gemini-3.5-flash-lite", chat: chatWithGemini, key: window.env.GEMINI_API_KEY },
+ { name: "claude-haiku-4-5-20251001", chat: chatWithClaude, key: window.env.ANTHROPIC_API_KEY },
],
async init() {
@@ -444,7 +461,7 @@
const modelObj = this.models.find((m) => m.name === this.activeModelName);
await modelObj.chat({
model: this.activeModelName,
- apiKey: window.env[modelObj.key],
+ apiKey: modelObj.key,
messages: this.messages,
signal: this.abortController.signal,
onContent: (chunk) => {
@@ -492,6 +509,17 @@
});
},
+ trimTo(msg) {
+ if (this.isBusy) return;
+ const idx = this.messages.indexOf(msg);
+ if (idx === -1) return;
+ this.messages = this.messages.slice(0, idx);
+ updateSessionHistory(this.sessionId, this.messages);
+ this.promptText = msg.content;
+ this.pendingImages = msg.images ? JSON.parse(JSON.stringify(msg.images)) : [];
+ this.$nextTick(() => this.$refs.promptInput.focus());
+ },
+
restoreConversation(msgs) {
this.messages = JSON.parse(JSON.stringify(msgs));
this.userHasScrolledUp = false;
@@ -564,11 +592,10 @@
"anthropic-version": "2023-06-01",
"anthropic-dangerous-direct-browser-access": "true",
},
- apiKey: window.env.ANTHROPIC_API_KEY,
});
}
- async function chatWithGemini({ onContent, onError, messages, signal, apiKey = window.env.GEMINI_API_KEY, model, ...rest }) {
+ async function chatWithGemini({ onContent, onError, messages, signal, apiKey, model, ...rest }) {
const contents = messages.map((msg, i, arr) => {
const role = msg.role === "assistant" ? "model" : "user";
let parts = [{ text: msg.content }];