Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@
</label>
<p class="text-xs text-gray-500 mb-2">
This role uses a curated set of plugins optimized for its purpose.
Switch to General role to customize plugins.
</p>
<div
class="flex flex-wrap gap-2 max-h-60 overflow-y-auto border border-gray-300 rounded p-2 bg-gray-50"
Expand Down
1 change: 1 addition & 0 deletions src/composables/useTextSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function useTextSession(
const instructions = options.buildInstructions({
startResponse: startResponse.value,
});
console.log("[useTextSession] instructions:", instructions);

if (instructions && instructions.trim()) {
conversationMessages.value = [
Expand Down
9 changes: 7 additions & 2 deletions src/composables/useUserPreferences.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { reactive, watch } from "vue";
import { DEFAULT_LANGUAGE_CODE, getLanguageName } from "../config/languages";
import { DEFAULT_ROLE_ID, getRole } from "../config/roles";
import { DEFAULT_ROLE_ID, getRole, ROLES } from "../config/roles";
import { pluginTools, getPluginSystemPrompts } from "../tools";
import {
DEFAULT_REALTIME_MODEL_ID,
Expand Down Expand Up @@ -205,7 +205,12 @@ export function useUserPreferences(): UseUserPreferencesReturn {
const customInstructionsText = state.customInstructions.trim()
? ` ${state.customInstructions}`
: "";
return `${role.prompt}\n${pluginPrompts}\n${customInstructionsText} The user's native language is ${getLanguageName(state.userLanguage)}.`;
const roleListText =
`\n\nYour current role is: ${role.id} (${role.name}). Available roles you can switch to:\n` +
ROLES.filter((r) => r.id !== role.id)
.map((r) => `- ${r.id}: ${r.name}`)
.join("\n");
return `${role.prompt}${roleListText}\n${pluginPrompts}\n${customInstructionsText} The user's native language is ${getLanguageName(state.userLanguage)}.`;
};

const buildTools = ({ startResponse }: BuildContext) =>
Expand Down
7 changes: 4 additions & 3 deletions src/config/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export const ROLES: Role[] = [
id: "general",
name: "General",
icon: "star",
includePluginPrompts: true,
pluginMode: "customizable",
includePluginPrompts: false,
pluginMode: "fixed",
availablePlugins: ["switchRole"],
prompt:
"You are a teacher who explains various things in a way that even middle school students can easily understand. If the user is asking for stock price, browse Yahoo Finance page with the ticker symbol, such as https://finance.yahoo.com/quote/TSLA/ or https://finance.yahoo.com/quote/BTC-USD/.",
"You are a helpful assistant. Help the user pick the right role for their task by switching to the appropriate role using the switchRole tool.",
},
{
id: "tutor",
Expand Down
Loading