janhq / jan

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer. Multiple engine support (llama.cpp, TensorRT-LLM)
https://jan.ai/
GNU Affero General Public License v3.0
23.81k stars 1.39k forks source link

feat: stop word model setting #4113

Closed urmauur closed 3 days ago

urmauur commented 4 days ago

Describe Your Changes

Type Modifications:

In settingComponent.ts, the ControllerType type now includes 'tag' as a possible value. The InputComponentProps type has been adjusted to allow value to be either string or string[]. ModelConfigInput Component:

The code in ModelConfigInput/index.tsx has been refactored to use a return statement with curly brackets {} instead of an implicit return, although its logic remains largely unchanged. SettingComponent Component:

In ModelSetting/SettingComponent.tsx, added support for the 'tag' controller type, including handling for the value to be string[] and modifying the onValueUpdated function to handle arrays of strings. ModelSetting Component:

In ModelSetting/index.tsx, the onValueChanged function signature was updated to accept string[]. TagInput Component:

A new component TagInput was created in TagInput/index.tsx. It provides the ability to enter tag-like data, allowing users to add strings to an array and render them as badges with an option to remove them. ThreadRightPanel Component:

In ThreadRightPanel/index.tsx, the onValueChanged function now supports receiving string[] values.

Component Utilities: In componentSettings.ts, support was added for the 'tag' controller type, setting its value from keySetting. In predefinedComponent.ts, the existing 'stop' setting was switched from an input type to a tag type, with a default value of an empty string array and a new placeholder.

Fixes Issues

default

Screenshot 2024-11-25 at 15 13 14

adding custom

Screenshot 2024-11-25 at 15 24 33

Thread json Screenshot 2024-11-25 at 15 24 27

No Stop word

Screenshot 2024-11-25 at 15 27 04

Self Checklist

github-actions[bot] commented 4 days ago

Barecheck - Code coverage report

Total: 69.24% Your code coverage diff: 0.03% ▴
Uncovered files and lines
FileLines
web/containers/ModelSetting/SettingComponent.tsx27-28, 31, 33, 44, 51-52, 61, 68-69, 78, 84-85, 93, 99
web/screens/Thread/ThreadCenterPanel/AssistantSetting/index.tsx44, 56
web/screens/Thread/ThreadRightPanel/index.tsx84, 97, 101, 104, 109-113, 117-118, 124, 128, 131, 157-158, 172, 177-178, 181-182, 184, 188, 192, 196, 202, 206, 239
web/screens/Thread/ThreadRightPanel/PromptTemplateSetting/index.tsx22, 24-25, 27-28, 30, 32-33, 35
web/utils/componentSettings.ts16, 19-23, 25, 29, 31, 35, 65-67