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
9 changes: 8 additions & 1 deletion src/lib/helpers/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,11 @@ const llmModelType = {
Embedding: 4,
Audio: 5
};
export const LlmModelType = Object.freeze(llmModelType);
export const LlmModelType = Object.freeze(llmModelType);

const reasoningEffortLevel = {
Low: "low",
Medium: "medium",
High: "high"
};
export const ReasoningEffortLevel = Object.freeze(reasoningEffortLevel);
1 change: 1 addition & 0 deletions src/lib/helpers/types/agentTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @property {string?} model
* @property {number} max_recursion_depth
* @property {number?} [max_output_tokens]
* @property {string?} [reasoning_effort_level]
*/


Expand Down
12 changes: 10 additions & 2 deletions src/lib/helpers/types/knowledgeTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@
* @property {number} [limit] - Data limit.
* @property {number} [confidence] - Confidence.
* @property {boolean} [with_vector] - Include vector or not.
* @property {VectorFilterGroup[]} [filter_groups] - Search filter groups.
*/

/**
* @typedef {Object} KnowledgeFilter
* @property {string | null} [start_id] - The start id.
* @property {number} size - Page size.
* @property {boolean} [with_vector] - Include vector or not.
* @property {string[]} [included_payloads] - Included payload keys.
* @property {{ key: string, value: string }[]} [search_pairs] - Search pairs.
* @property {string[]} [fields] - Included payload fields.
* @property {VectorFilterGroup[]} [filter_groups] - Search filter groups.
*/

/**
* @typedef {Object} VectorFilterGroup
* @property {string} [filter_operator] - The filter operator.
* @property {{ key: string, value: string }[]} [filters] - Search filters.
*/

/**
Expand All @@ -32,6 +39,7 @@
* @property {any} data - The knowledge data.
* @property {number} [score] - The knowledge score.
* @property {number[]} [vector] - The knowledge vector.
* @property {number} [vector_dimension] - The vector dimension.
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function splitTextByCase(str) {
if (!str) return str;

let words = str.split("_");
if (words.length === 0) {
if (words.length === 1) {
// split by camel case
words = str.split(/(?=[A-Z])/);
}
Expand Down
29 changes: 29 additions & 0 deletions src/lib/scss/custom/pages/_knowledgebase.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
}
}

.operator-tooltip {
.tooltip-inner {
width: fit-content !important;
max-width: 300px !important;
text-align: left !important;
}
}

.knowledge-textarea {
border-radius: 5px;
border-color: var(--#{$prefix}light) !important;
Expand Down Expand Up @@ -245,6 +253,24 @@
font-size: 15px;
}
}

.payload-container {
display: flex;
flex-direction: column;
gap: 10px;
max-height: 280px;
overflow-y: auto;
scrollbar-width: none;

.payload-item {
display: flex;
gap: 10px;

.payload-item-content {
flex: 0.5;
}
}
}
}

.knowledge-doc-upload-container {
Expand Down Expand Up @@ -360,6 +386,9 @@
display: flex;
flex-direction: column;
gap: 10px;
max-height: 300px;
overflow-y: auto;
scrollbar-width: none;

.knowledge-adv-search-item {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Card, CardBody, Input } from '@sveltestrap/sveltestrap';
import { getLlmProviders, getLlmProviderModels } from '$lib/services/llm-provider-service';
import { INTEGER_REGEX } from '$lib/helpers/constants';
import { ReasoningEffortLevel } from '$lib/helpers/enums';

/** @type {import('$agentTypes').AgentModel} */
export let agent;
Expand All @@ -18,6 +19,14 @@
}

const recursiveDepthLowerLimit = 1;
/** @type {import('$commonTypes').LabelValuePair[]} */
const reasonLevelOptions = [
{ value: '', label: '' },
...Object.entries(ReasoningEffortLevel).map(([k, v]) => ({
value: v,
label: v
}))
];

let config = agent.llm_config;

Expand Down Expand Up @@ -89,6 +98,12 @@
handleAgentChange();
}

/** @param {any} e */
function changeReasoningEffortLevel(e) {
config.reasoning_effort_level = e.target.value || null;
handleAgentChange();
}

/** @param {any} e */
function validateIntegerInput(e) {
const reg = new RegExp(INTEGER_REGEX, 'g');
Expand Down Expand Up @@ -164,5 +179,20 @@
/>
</div>
</div>

<div class="mb-3 row">
<label for="example-text-input" class="col-md-3 col-form-label">
Reasoning level
</label>
<div class="col-md-9">
<Input type="select" value={config.reasoning_effort_level} on:change={e => changeReasoningEffortLevel(e)}>
{#each reasonLevelOptions as option}
<option value={option.value} selected={option.value == config.reasoning_effort_level}>
{option.label}
</option>
{/each}
</Input>
</div>
</div>
</CardBody>
</Card>
Loading