mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-15 15:08:52 +01:00
Merge branch 'dev' into feat/context-window-ui
This commit is contained in:
commit
cb8322ca85
407 changed files with 25479 additions and 19894 deletions
|
|
@ -66,6 +66,8 @@ export const messages = (params: q.MessagesListParams) => {
|
|||
|
||||
export const messagesArtifacts = (messageId: string) => `${messagesRoot}/artifact/${messageId}`;
|
||||
|
||||
export const messagesBranch = () => `${messagesRoot}/branch`;
|
||||
|
||||
const shareRoot = `${BASE_URL}/api/share`;
|
||||
export const shareMessages = (shareId: string) => `${shareRoot}/${shareId}`;
|
||||
export const getSharedLink = (conversationId: string) => `${shareRoot}/link/${conversationId}`;
|
||||
|
|
@ -101,7 +103,8 @@ export const conversations = (params: q.ConversationListParams) => {
|
|||
|
||||
export const conversationById = (id: string) => `${conversationsRoot}/${id}`;
|
||||
|
||||
export const genTitle = () => `${conversationsRoot}/gen_title`;
|
||||
export const genTitle = (conversationId: string) =>
|
||||
`${conversationsRoot}/gen_title/${encodeURIComponent(conversationId)}`;
|
||||
|
||||
export const updateConversation = () => `${conversationsRoot}/update`;
|
||||
|
||||
|
|
@ -226,6 +229,8 @@ export const agents = ({ path = '', options }: { path?: string; options?: object
|
|||
return url;
|
||||
};
|
||||
|
||||
export const activeJobs = () => `${BASE_URL}/api/agents/chat/active`;
|
||||
|
||||
export const mcp = {
|
||||
tools: `${BASE_URL}/api/mcp/tools`,
|
||||
servers: `${BASE_URL}/api/mcp/servers`,
|
||||
|
|
|
|||
|
|
@ -849,6 +849,11 @@ export const configSchema = z.object({
|
|||
includedTools: z.array(z.string()).optional(),
|
||||
filteredTools: z.array(z.string()).optional(),
|
||||
mcpServers: MCPServersSchema.optional(),
|
||||
mcpSettings: z
|
||||
.object({
|
||||
allowedDomains: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
interface: interfaceSchema,
|
||||
turnstile: turnstileSchema.optional(),
|
||||
fileStrategy: fileSourceSchema.default(FileSources.local),
|
||||
|
|
@ -1234,6 +1239,7 @@ export enum InfiniteCollections {
|
|||
*/
|
||||
export enum Time {
|
||||
ONE_DAY = 86400000,
|
||||
TWELVE_HOURS = 43200000,
|
||||
ONE_HOUR = 3600000,
|
||||
THIRTY_MINUTES = 1800000,
|
||||
TEN_MINUTES = 600000,
|
||||
|
|
@ -1595,7 +1601,7 @@ export enum TTSProviders {
|
|||
/** Enum for app-wide constants */
|
||||
export enum Constants {
|
||||
/** Key for the app's version. */
|
||||
VERSION = 'v0.8.1',
|
||||
VERSION = 'v0.8.2-rc1',
|
||||
/** Key for the Custom Config's version (librechat.yaml). */
|
||||
CONFIG_VERSION = '1.3.1',
|
||||
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import * as s from './schemas';
|
|||
export default function createPayload(submission: t.TSubmission) {
|
||||
const {
|
||||
isEdited,
|
||||
addedConvo,
|
||||
userMessage,
|
||||
isContinued,
|
||||
isTemporary,
|
||||
|
|
@ -32,6 +33,7 @@ export default function createPayload(submission: t.TSubmission) {
|
|||
...userMessage,
|
||||
...endpointOption,
|
||||
endpoint,
|
||||
addedConvo,
|
||||
isTemporary,
|
||||
isRegenerate,
|
||||
editedContent,
|
||||
|
|
|
|||
|
|
@ -724,7 +724,7 @@ export function archiveConversation(
|
|||
}
|
||||
|
||||
export function genTitle(payload: m.TGenTitleRequest): Promise<m.TGenTitleResponse> {
|
||||
return request.post(endpoints.genTitle(), payload);
|
||||
return request.get(endpoints.genTitle(payload.conversationId));
|
||||
}
|
||||
|
||||
export const listMessages = (params?: q.MessagesListParams): Promise<q.MessagesListResponse> => {
|
||||
|
|
@ -756,6 +756,12 @@ export const editArtifact = async ({
|
|||
return request.post(endpoints.messagesArtifacts(messageId), params);
|
||||
};
|
||||
|
||||
export const branchMessage = async (
|
||||
payload: m.TBranchMessageRequest,
|
||||
): Promise<m.TBranchMessageResponse> => {
|
||||
return request.post(endpoints.messagesBranch(), payload);
|
||||
};
|
||||
|
||||
export function getMessagesByConvoId(conversationId: string): Promise<s.TMessage[]> {
|
||||
if (
|
||||
conversationId === config.Constants.NEW_CONVO ||
|
||||
|
|
@ -1037,3 +1043,12 @@ export function getGraphApiToken(params: q.GraphTokenParams): Promise<q.GraphTok
|
|||
export function getDomainServerBaseUrl(): string {
|
||||
return `${endpoints.apiBaseUrl()}/api`;
|
||||
}
|
||||
|
||||
/* Active Jobs */
|
||||
export interface ActiveJobsResponse {
|
||||
activeJobIds: string[];
|
||||
}
|
||||
|
||||
export const getActiveJobs = (): Promise<ActiveJobsResponse> => {
|
||||
return request.get(endpoints.activeJobs());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,11 @@ export const fullMimeTypesList = [
|
|||
'image/heic',
|
||||
'image/heif',
|
||||
'application/x-tar',
|
||||
'application/x-sh',
|
||||
'application/typescript',
|
||||
'application/sql',
|
||||
'application/yaml',
|
||||
'application/vnd.coffeescript',
|
||||
'application/xml',
|
||||
'application/zip',
|
||||
'image/svg',
|
||||
|
|
@ -140,7 +144,7 @@ export const textMimeTypes =
|
|||
/^(text\/(x-c|x-csharp|tab-separated-values|x-c\+\+|x-h|x-java|html|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|css|vtt|javascript|csv|xml))$/;
|
||||
|
||||
export const applicationMimeTypes =
|
||||
/^(application\/(epub\+zip|csv|json|pdf|x-tar|typescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|xml|zip))$/;
|
||||
/^(application\/(epub\+zip|csv|json|pdf|x-tar|x-sh|typescript|sql|yaml|vnd\.coffeescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|xml|zip))$/;
|
||||
|
||||
export const imageMimeTypes = /^image\/(jpeg|gif|png|webp|heic|heif)$/;
|
||||
|
||||
|
|
@ -180,24 +184,110 @@ export const codeInterpreterMimeTypes = [
|
|||
];
|
||||
|
||||
export const codeTypeMapping: { [key: string]: string } = {
|
||||
c: 'text/x-c',
|
||||
cs: 'text/x-csharp',
|
||||
cpp: 'text/x-c++',
|
||||
h: 'text/x-h',
|
||||
md: 'text/markdown',
|
||||
php: 'text/x-php',
|
||||
py: 'text/x-python',
|
||||
rb: 'text/x-ruby',
|
||||
tex: 'text/x-tex',
|
||||
js: 'text/javascript',
|
||||
sh: 'application/x-sh',
|
||||
ts: 'application/typescript',
|
||||
tar: 'application/x-tar',
|
||||
zip: 'application/zip',
|
||||
yml: 'application/x-yaml',
|
||||
yaml: 'application/x-yaml',
|
||||
log: 'text/plain',
|
||||
tsv: 'text/tab-separated-values',
|
||||
c: 'text/x-c', // .c - C source
|
||||
cs: 'text/x-csharp', // .cs - C# source
|
||||
cpp: 'text/x-c++', // .cpp - C++ source
|
||||
h: 'text/x-h', // .h - C/C++ header
|
||||
md: 'text/markdown', // .md - Markdown
|
||||
php: 'text/x-php', // .php - PHP source
|
||||
py: 'text/x-python', // .py - Python source
|
||||
rb: 'text/x-ruby', // .rb - Ruby source
|
||||
tex: 'text/x-tex', // .tex - LaTeX source
|
||||
js: 'text/javascript', // .js - JavaScript source
|
||||
sh: 'application/x-sh', // .sh - Shell script
|
||||
ts: 'application/typescript', // .ts - TypeScript source
|
||||
tar: 'application/x-tar', // .tar - Tar archive
|
||||
zip: 'application/zip', // .zip - ZIP archive
|
||||
log: 'text/plain', // .log - Log file
|
||||
tsv: 'text/tab-separated-values', // .tsv - Tab-separated values
|
||||
yml: 'application/yaml', // .yml - YAML
|
||||
yaml: 'application/yaml', // .yaml - YAML
|
||||
sql: 'application/sql', // .sql - SQL (IANA registered)
|
||||
dart: 'text/plain', // .dart - Dart source
|
||||
coffee: 'application/vnd.coffeescript', // .coffee - CoffeeScript (IANA registered)
|
||||
go: 'text/plain', // .go - Go source
|
||||
rs: 'text/plain', // .rs - Rust source
|
||||
swift: 'text/plain', // .swift - Swift source
|
||||
kt: 'text/plain', // .kt - Kotlin source
|
||||
kts: 'text/plain', // .kts - Kotlin script
|
||||
scala: 'text/plain', // .scala - Scala source
|
||||
lua: 'text/plain', // .lua - Lua source
|
||||
r: 'text/plain', // .r - R source
|
||||
pl: 'text/plain', // .pl - Perl source
|
||||
pm: 'text/plain', // .pm - Perl module
|
||||
groovy: 'text/plain', // .groovy - Groovy source
|
||||
gradle: 'text/plain', // .gradle - Gradle build script
|
||||
clj: 'text/plain', // .clj - Clojure source
|
||||
cljs: 'text/plain', // .cljs - ClojureScript source
|
||||
cljc: 'text/plain', // .cljc - Clojure common source
|
||||
elm: 'text/plain', // .elm - Elm source
|
||||
erl: 'text/plain', // .erl - Erlang source
|
||||
hrl: 'text/plain', // .hrl - Erlang header
|
||||
ex: 'text/plain', // .ex - Elixir source
|
||||
exs: 'text/plain', // .exs - Elixir script
|
||||
hs: 'text/plain', // .hs - Haskell source
|
||||
lhs: 'text/plain', // .lhs - Literate Haskell source
|
||||
ml: 'text/plain', // .ml - OCaml source
|
||||
mli: 'text/plain', // .mli - OCaml interface
|
||||
fs: 'text/plain', // .fs - F# source
|
||||
fsx: 'text/plain', // .fsx - F# script
|
||||
lisp: 'text/plain', // .lisp - Lisp source
|
||||
cl: 'text/plain', // .cl - Common Lisp source
|
||||
scm: 'text/plain', // .scm - Scheme source
|
||||
rkt: 'text/plain', // .rkt - Racket source
|
||||
jsx: 'text/plain', // .jsx - React JSX
|
||||
tsx: 'text/plain', // .tsx - React TSX
|
||||
vue: 'text/plain', // .vue - Vue component
|
||||
svelte: 'text/plain', // .svelte - Svelte component
|
||||
astro: 'text/plain', // .astro - Astro component
|
||||
scss: 'text/plain', // .scss - SCSS source
|
||||
sass: 'text/plain', // .sass - Sass source
|
||||
less: 'text/plain', // .less - Less source
|
||||
styl: 'text/plain', // .styl - Stylus source
|
||||
toml: 'text/plain', // .toml - TOML config
|
||||
ini: 'text/plain', // .ini - INI config
|
||||
cfg: 'text/plain', // .cfg - Config file
|
||||
conf: 'text/plain', // .conf - Config file
|
||||
env: 'text/plain', // .env - Environment file
|
||||
properties: 'text/plain', // .properties - Java properties
|
||||
graphql: 'text/plain', // .graphql - GraphQL schema/query
|
||||
gql: 'text/plain', // .gql - GraphQL schema/query
|
||||
proto: 'text/plain', // .proto - Protocol Buffers
|
||||
dockerfile: 'text/plain', // Dockerfile
|
||||
makefile: 'text/plain', // Makefile
|
||||
cmake: 'text/plain', // .cmake - CMake script
|
||||
rake: 'text/plain', // .rake - Rake task
|
||||
gemspec: 'text/plain', // .gemspec - Ruby gem spec
|
||||
bash: 'text/plain', // .bash - Bash script
|
||||
zsh: 'text/plain', // .zsh - Zsh script
|
||||
fish: 'text/plain', // .fish - Fish script
|
||||
ps1: 'text/plain', // .ps1 - PowerShell script
|
||||
psm1: 'text/plain', // .psm1 - PowerShell module
|
||||
bat: 'text/plain', // .bat - Batch script
|
||||
cmd: 'text/plain', // .cmd - Windows command script
|
||||
asm: 'text/plain', // .asm - Assembly source
|
||||
s: 'text/plain', // .s - Assembly source
|
||||
v: 'text/plain', // .v - V or Verilog source
|
||||
zig: 'text/plain', // .zig - Zig source
|
||||
nim: 'text/plain', // .nim - Nim source
|
||||
cr: 'text/plain', // .cr - Crystal source
|
||||
d: 'text/plain', // .d - D source
|
||||
pas: 'text/plain', // .pas - Pascal source
|
||||
pp: 'text/plain', // .pp - Pascal/Puppet source
|
||||
f90: 'text/plain', // .f90 - Fortran 90 source
|
||||
f95: 'text/plain', // .f95 - Fortran 95 source
|
||||
f03: 'text/plain', // .f03 - Fortran 2003 source
|
||||
jl: 'text/plain', // .jl - Julia source
|
||||
m: 'text/plain', // .m - Objective-C/MATLAB source
|
||||
mm: 'text/plain', // .mm - Objective-C++ source
|
||||
ada: 'text/plain', // .ada - Ada source
|
||||
adb: 'text/plain', // .adb - Ada body
|
||||
ads: 'text/plain', // .ads - Ada spec
|
||||
cob: 'text/plain', // .cob - COBOL source
|
||||
cbl: 'text/plain', // .cbl - COBOL source
|
||||
tcl: 'text/plain', // .tcl - Tcl source
|
||||
awk: 'text/plain', // .awk - AWK script
|
||||
sed: 'text/plain', // .sed - Sed script
|
||||
};
|
||||
|
||||
/** Maps image extensions to MIME types for formats browsers may not recognize */
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ export enum QueryKeys {
|
|||
/* MCP Servers */
|
||||
mcpServers = 'mcpServers',
|
||||
mcpServer = 'mcpServer',
|
||||
/* Active Jobs */
|
||||
activeJobs = 'activeJobs',
|
||||
}
|
||||
|
||||
// Dynamic query keys that require parameters
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ export type TModelSpec = {
|
|||
* - If omitted, the spec appears as a standalone item at the top level
|
||||
*/
|
||||
group?: string;
|
||||
/**
|
||||
* Optional icon URL for the group this spec belongs to.
|
||||
* Only needs to be set on one spec per group - the first one found with a groupIcon will be used.
|
||||
* Can be a URL or an endpoint name to use its icon.
|
||||
*/
|
||||
groupIcon?: string | EModelEndpoint;
|
||||
showIconInMenu?: boolean;
|
||||
showIconInHeader?: boolean;
|
||||
iconURL?: string | EModelEndpoint; // Allow using project-included icons
|
||||
|
|
@ -40,6 +46,7 @@ export const tModelSpecSchema = z.object({
|
|||
default: z.boolean().optional(),
|
||||
description: z.string().optional(),
|
||||
group: z.string().optional(),
|
||||
groupIcon: z.union([z.string(), eModelEndpointSchema]).optional(),
|
||||
showIconInMenu: z.boolean().optional(),
|
||||
showIconInHeader: z.boolean().optional(),
|
||||
iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ const extractOmniVersion = (modelStr: string): string => {
|
|||
return '';
|
||||
};
|
||||
|
||||
export const getResponseSender = (endpointOption: t.TEndpointOption): string => {
|
||||
export const getResponseSender = (endpointOption: Partial<t.TEndpointOption>): string => {
|
||||
const {
|
||||
model: _m,
|
||||
endpoint: _e,
|
||||
|
|
@ -216,10 +216,11 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string =>
|
|||
if (
|
||||
[EModelEndpoint.openAI, EModelEndpoint.bedrock, EModelEndpoint.azureOpenAI].includes(endpoint)
|
||||
) {
|
||||
if (chatGptLabel) {
|
||||
return chatGptLabel;
|
||||
} else if (modelLabel) {
|
||||
if (modelLabel) {
|
||||
return modelLabel;
|
||||
} else if (chatGptLabel) {
|
||||
// @deprecated - prefer modelLabel
|
||||
return chatGptLabel;
|
||||
} else if (model && extractOmniVersion(model)) {
|
||||
return extractOmniVersion(model);
|
||||
} else if (model && (model.includes('mistral') || model.includes('codestral'))) {
|
||||
|
|
@ -255,6 +256,7 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string =>
|
|||
if (modelLabel) {
|
||||
return modelLabel;
|
||||
} else if (chatGptLabel) {
|
||||
// @deprecated - prefer modelLabel
|
||||
return chatGptLabel;
|
||||
} else if (model && extractOmniVersion(model)) {
|
||||
return extractOmniVersion(model);
|
||||
|
|
@ -414,3 +416,138 @@ export function replaceSpecialVars({ text, user }: { text: string; user?: t.TUse
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsed ephemeral agent ID result
|
||||
*/
|
||||
export type ParsedEphemeralAgentId = {
|
||||
endpoint: string;
|
||||
model: string;
|
||||
sender?: string;
|
||||
index?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes an ephemeral agent ID from endpoint, model, optional sender, and optional index.
|
||||
* Uses __ to replace : (reserved in graph node names) and ___ to separate sender.
|
||||
*
|
||||
* Format: endpoint__model___sender or endpoint__model___sender____index (if index provided)
|
||||
*
|
||||
* @example
|
||||
* encodeEphemeralAgentId({ endpoint: 'openAI', model: 'gpt-4o', sender: 'GPT-4o' })
|
||||
* // => 'openAI__gpt-4o___GPT-4o'
|
||||
*
|
||||
* @example
|
||||
* encodeEphemeralAgentId({ endpoint: 'openAI', model: 'gpt-4o', sender: 'GPT-4o', index: 1 })
|
||||
* // => 'openAI__gpt-4o___GPT-4o____1'
|
||||
*/
|
||||
export function encodeEphemeralAgentId({
|
||||
endpoint,
|
||||
model,
|
||||
sender,
|
||||
index,
|
||||
}: {
|
||||
endpoint: string;
|
||||
model: string;
|
||||
sender?: string;
|
||||
index?: number;
|
||||
}): string {
|
||||
const base = `${endpoint}:${model}`.replace(/:/g, '__');
|
||||
let result = base;
|
||||
if (sender) {
|
||||
// Use ___ as separator before sender to distinguish from __ in model names
|
||||
result = `${base}___${sender.replace(/:/g, '__')}`;
|
||||
}
|
||||
if (index != null) {
|
||||
// Use ____ (4 underscores) as separator for index
|
||||
result = `${result}____${index}`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an ephemeral agent ID back into its components.
|
||||
* Returns undefined if the ID doesn't match the expected format.
|
||||
*
|
||||
* Format: endpoint__model___sender or endpoint__model___sender____index
|
||||
* - ____ (4 underscores) separates optional index suffix
|
||||
* - ___ (triple underscore) separates model from optional sender
|
||||
* - __ (double underscore) replaces : in endpoint/model names
|
||||
*
|
||||
* @example
|
||||
* parseEphemeralAgentId('openAI__gpt-4o___GPT-4o')
|
||||
* // => { endpoint: 'openAI', model: 'gpt-4o', sender: 'GPT-4o' }
|
||||
*
|
||||
* @example
|
||||
* parseEphemeralAgentId('openAI__gpt-4o___GPT-4o____1')
|
||||
* // => { endpoint: 'openAI', model: 'gpt-4o', sender: 'GPT-4o', index: 1 }
|
||||
*/
|
||||
export function parseEphemeralAgentId(agentId: string): ParsedEphemeralAgentId | undefined {
|
||||
if (!agentId.includes('__')) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// First check for index suffix (separated by ____)
|
||||
let index: number | undefined;
|
||||
let workingId = agentId;
|
||||
if (agentId.includes('____')) {
|
||||
const lastIndexSep = agentId.lastIndexOf('____');
|
||||
const indexStr = agentId.slice(lastIndexSep + 4);
|
||||
const parsedIndex = parseInt(indexStr, 10);
|
||||
if (!isNaN(parsedIndex)) {
|
||||
index = parsedIndex;
|
||||
workingId = agentId.slice(0, lastIndexSep);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for sender (separated by ___)
|
||||
let sender: string | undefined;
|
||||
let mainPart = workingId;
|
||||
if (workingId.includes('___')) {
|
||||
const [before, after] = workingId.split('___');
|
||||
mainPart = before;
|
||||
// Restore colons in sender if any
|
||||
sender = after?.replace(/__/g, ':');
|
||||
}
|
||||
|
||||
const [endpoint, ...modelParts] = mainPart.split('__');
|
||||
if (!endpoint || modelParts.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
// Restore colons in model name (model names can contain colons like claude-3:opus)
|
||||
const model = modelParts.join(':');
|
||||
return { endpoint, model, sender, index };
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an agent ID represents an ephemeral (non-saved) agent.
|
||||
* Real agent IDs always start with "agent_", so anything else is ephemeral.
|
||||
*/
|
||||
export function isEphemeralAgentId(agentId: string | null | undefined): boolean {
|
||||
return !agentId?.startsWith('agent_');
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the index suffix (____N) from an agent ID if present.
|
||||
* Works with both ephemeral and real agent IDs.
|
||||
*
|
||||
* @example
|
||||
* stripAgentIdSuffix('agent_abc123____1') // => 'agent_abc123'
|
||||
* stripAgentIdSuffix('openAI__gpt-4o___GPT-4o____1') // => 'openAI__gpt-4o___GPT-4o'
|
||||
* stripAgentIdSuffix('agent_abc123') // => 'agent_abc123' (unchanged)
|
||||
*/
|
||||
export function stripAgentIdSuffix(agentId: string): string {
|
||||
return agentId.replace(/____\d+$/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an index suffix (____N) to an agent ID.
|
||||
* Used to distinguish parallel agents with the same base ID.
|
||||
*
|
||||
* @example
|
||||
* appendAgentIdSuffix('agent_abc123', 1) // => 'agent_abc123____1'
|
||||
* appendAgentIdSuffix('openAI__gpt-4o___GPT-4o', 1) // => 'openAI__gpt-4o___GPT-4o____1'
|
||||
*/
|
||||
export function appendAgentIdSuffix(agentId: string, index: number): string {
|
||||
return `${agentId}____${index}`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ export const documentSupportedProviders = new Set<string>([
|
|||
EModelEndpoint.anthropic,
|
||||
EModelEndpoint.openAI,
|
||||
EModelEndpoint.custom,
|
||||
EModelEndpoint.azureOpenAI,
|
||||
// handled in AttachFileMenu and DragDropModal since azureOpenAI only supports documents with Use Responses API set to true
|
||||
// EModelEndpoint.azureOpenAI,
|
||||
EModelEndpoint.google,
|
||||
Providers.VERTEXAI,
|
||||
Providers.MISTRALAI,
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ export type TPayload = Partial<TMessage> &
|
|||
isTemporary: boolean;
|
||||
ephemeralAgent?: TEphemeralAgent | null;
|
||||
editedContent?: TEditedContent | null;
|
||||
/** Added conversation for multi-convo feature */
|
||||
addedConvo?: TConversation;
|
||||
};
|
||||
|
||||
export type TEditedContent =
|
||||
|
|
@ -136,6 +138,8 @@ export type TSubmission = {
|
|||
clientTimestamp?: string;
|
||||
ephemeralAgent?: TEphemeralAgent | null;
|
||||
editedContent?: TEditedContent | null;
|
||||
/** Added conversation for multi-convo feature */
|
||||
addedConvo?: TConversation;
|
||||
};
|
||||
|
||||
export type EventSubmission = Omit<TSubmission, 'initialResponse'> & { initialResponse: TMessage };
|
||||
|
|
|
|||
|
|
@ -33,11 +33,26 @@ export namespace Agents {
|
|||
image_url: string | { url: string; detail?: ImageDetail };
|
||||
};
|
||||
|
||||
export type MessageContentVideoUrl = {
|
||||
type: ContentTypes.VIDEO_URL;
|
||||
video_url: { url: string };
|
||||
};
|
||||
|
||||
export type MessageContentInputAudio = {
|
||||
type: ContentTypes.INPUT_AUDIO;
|
||||
input_audio: {
|
||||
data: string;
|
||||
format: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type MessageContentComplex =
|
||||
| ReasoningContentText
|
||||
| AgentUpdate
|
||||
| MessageContentText
|
||||
| MessageContentImageUrl
|
||||
| MessageContentVideoUrl
|
||||
| MessageContentInputAudio
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
| (Record<string, any> & { type?: ContentTypes | string })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
|
@ -166,11 +181,40 @@ export namespace Agents {
|
|||
type: StepTypes;
|
||||
id: string; // #new
|
||||
runId?: string; // #new
|
||||
agentId?: string; // #new
|
||||
index: number; // #new
|
||||
stepIndex?: number; // #new
|
||||
/** Group ID for parallel content - parts with same groupId are displayed in columns */
|
||||
groupId?: number; // #new
|
||||
stepDetails: StepDetails;
|
||||
usage: null | object;
|
||||
};
|
||||
|
||||
/** Content part for aggregated message content */
|
||||
export interface ContentPart {
|
||||
type: string;
|
||||
text?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/** User message metadata for rebuilding submission on reconnect */
|
||||
export interface UserMessageMeta {
|
||||
messageId: string;
|
||||
parentMessageId?: string;
|
||||
conversationId?: string;
|
||||
text?: string;
|
||||
}
|
||||
|
||||
/** State data sent to reconnecting clients */
|
||||
export interface ResumeState {
|
||||
runSteps: RunStep[];
|
||||
/** Aggregated content parts - can be MessageContentComplex[] or ContentPart[] */
|
||||
aggregatedContent?: MessageContentComplex[];
|
||||
userMessage?: UserMessageMeta;
|
||||
responseMessageId?: string;
|
||||
conversationId?: string;
|
||||
sender?: string;
|
||||
}
|
||||
/**
|
||||
* Represents a run step delta i.e. any changed fields on a run step during
|
||||
* streaming.
|
||||
|
|
@ -266,6 +310,8 @@ export namespace Agents {
|
|||
| ContentTypes.THINK
|
||||
| ContentTypes.TEXT
|
||||
| ContentTypes.IMAGE_URL
|
||||
| ContentTypes.VIDEO_URL
|
||||
| ContentTypes.INPUT_AUDIO
|
||||
| string;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ export type AgentModelParameters = {
|
|||
top_p: AgentParameterValue;
|
||||
frequency_penalty: AgentParameterValue;
|
||||
presence_penalty: AgentParameterValue;
|
||||
useResponsesApi?: boolean;
|
||||
};
|
||||
|
||||
export interface AgentBaseResource {
|
||||
|
|
@ -466,8 +467,17 @@ export type PartMetadata = {
|
|||
action?: boolean;
|
||||
auth?: string;
|
||||
expires_at?: number;
|
||||
/** Index indicating parallel sibling content (same stepIndex in multi-agent runs) */
|
||||
siblingIndex?: number;
|
||||
/** Agent ID for parallel agent rendering - identifies which agent produced this content */
|
||||
agentId?: string;
|
||||
/** Group ID for parallel content - parts with same groupId are displayed in columns */
|
||||
groupId?: number;
|
||||
};
|
||||
|
||||
/** Metadata for parallel content rendering - subset of PartMetadata */
|
||||
export type ContentMetadata = Pick<PartMetadata, 'agentId' | 'groupId'>;
|
||||
|
||||
export type ContentPart = (
|
||||
| CodeToolCall
|
||||
| RetrievalToolCall
|
||||
|
|
@ -482,18 +492,18 @@ export type ContentPart = (
|
|||
export type TextData = (Text & PartMetadata) | undefined;
|
||||
|
||||
export type TMessageContentParts =
|
||||
| {
|
||||
| ({
|
||||
type: ContentTypes.ERROR;
|
||||
text?: string | TextData;
|
||||
error?: string;
|
||||
}
|
||||
| { type: ContentTypes.THINK; think?: string | TextData }
|
||||
| {
|
||||
} & ContentMetadata)
|
||||
| ({ type: ContentTypes.THINK; think?: string | TextData } & ContentMetadata)
|
||||
| ({
|
||||
type: ContentTypes.TEXT;
|
||||
text?: string | TextData;
|
||||
tool_call_ids?: string[];
|
||||
}
|
||||
| {
|
||||
} & ContentMetadata)
|
||||
| ({
|
||||
type: ContentTypes.TOOL_CALL;
|
||||
tool_call: (
|
||||
| CodeToolCall
|
||||
|
|
@ -503,10 +513,12 @@ export type TMessageContentParts =
|
|||
| Agents.AgentToolCall
|
||||
) &
|
||||
PartMetadata;
|
||||
}
|
||||
| { type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata }
|
||||
| Agents.AgentUpdate
|
||||
| Agents.MessageContentImageUrl;
|
||||
} & ContentMetadata)
|
||||
| ({ type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata } & ContentMetadata)
|
||||
| (Agents.AgentUpdate & ContentMetadata)
|
||||
| (Agents.MessageContentImageUrl & ContentMetadata)
|
||||
| (Agents.MessageContentVideoUrl & ContentMetadata)
|
||||
| (Agents.MessageContentInputAudio & ContentMetadata);
|
||||
|
||||
export type StreamContentData = TMessageContentParts & {
|
||||
/** The index of the current content part */
|
||||
|
|
|
|||
|
|
@ -381,6 +381,20 @@ export type EditArtifactOptions = MutationOptions<
|
|||
Error
|
||||
>;
|
||||
|
||||
export type TBranchMessageRequest = {
|
||||
messageId: string;
|
||||
agentId: string;
|
||||
};
|
||||
|
||||
export type TBranchMessageResponse = types.TMessage;
|
||||
|
||||
export type BranchMessageOptions = MutationOptions<
|
||||
TBranchMessageResponse,
|
||||
TBranchMessageRequest,
|
||||
unknown,
|
||||
Error
|
||||
>;
|
||||
|
||||
export type TLogoutResponse = {
|
||||
message: string;
|
||||
redirect?: string;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ export enum ContentTypes {
|
|||
TOOL_CALL = 'tool_call',
|
||||
IMAGE_FILE = 'image_file',
|
||||
IMAGE_URL = 'image_url',
|
||||
VIDEO_URL = 'video_url',
|
||||
INPUT_AUDIO = 'input_audio',
|
||||
AGENT_UPDATE = 'agent_update',
|
||||
ERROR = 'error',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import type { Logger as WinstonLogger } from 'winston';
|
||||
import type { RunnableConfig } from '@langchain/core/runnables';
|
||||
|
||||
export type SearchRefType = 'search' | 'image' | 'news' | 'video' | 'ref';
|
||||
|
||||
|
|
@ -174,16 +173,6 @@ export interface CohereRerankerResponse {
|
|||
export type SafeSearchLevel = 0 | 1 | 2;
|
||||
|
||||
export type Logger = WinstonLogger;
|
||||
export interface SearchToolConfig extends SearchConfig, ProcessSourcesConfig, FirecrawlConfig {
|
||||
logger?: Logger;
|
||||
safeSearch?: SafeSearchLevel;
|
||||
jinaApiKey?: string;
|
||||
jinaApiUrl?: string;
|
||||
cohereApiKey?: string;
|
||||
rerankerType?: RerankerType;
|
||||
onSearchResults?: (results: SearchResult, runnableConfig?: RunnableConfig) => void;
|
||||
onGetHighlights?: (link: string) => void;
|
||||
}
|
||||
export interface MediaReference {
|
||||
originalUrl: string;
|
||||
title?: string;
|
||||
|
|
@ -290,18 +279,6 @@ export interface FirecrawlScraperConfig {
|
|||
logger?: Logger;
|
||||
}
|
||||
|
||||
export type GetSourcesParams = {
|
||||
query: string;
|
||||
date?: DATE_RANGE;
|
||||
country?: string;
|
||||
numResults?: number;
|
||||
safeSearch?: SearchToolConfig['safeSearch'];
|
||||
images?: boolean;
|
||||
videos?: boolean;
|
||||
news?: boolean;
|
||||
type?: 'search' | 'images' | 'videos' | 'news';
|
||||
};
|
||||
|
||||
/** Serper API */
|
||||
export interface VideoResult {
|
||||
title?: string;
|
||||
|
|
@ -609,12 +586,3 @@ export interface SearXNGResult {
|
|||
publishedDate?: string;
|
||||
img_src?: string;
|
||||
}
|
||||
|
||||
export type ProcessSourcesFields = {
|
||||
result: SearchResult;
|
||||
numElements: number;
|
||||
query: string;
|
||||
news: boolean;
|
||||
proMode: boolean;
|
||||
onGetHighlights: SearchToolConfig['onGetHighlights'];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue