-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/lm-studio
- Loading branch information
Showing
6 changed files
with
154 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ export const LANGCHAIN_SUPPORT_TEXT_LIST = [ | |
|
||
'sh', | ||
'patch', | ||
'log', | ||
// js | ||
'js', | ||
'jsx', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ChatFileItem } from '@/types/message'; | ||
|
||
const filePrompt = (item: ChatFileItem) => | ||
`<file id="${item.id}" name="${item.name}" type="${item.fileType}" size="${item.size}" url="${item.url}"></file>`; | ||
|
||
export const filePrompts = (fileList: ChatFileItem[]) => { | ||
if (fileList.length === 0) return ''; | ||
|
||
const prompt = `<files> | ||
<files_docstring>here are user upload files you can refer to</files_docstring> | ||
${fileList.map((item) => filePrompt(item)).join('\n')} | ||
</files>`; | ||
|
||
return prompt.trim(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ChatImageItem } from '@/types/message'; | ||
|
||
const imagePrompt = (item: ChatImageItem) => `<image name="${item.alt}" url="${item.url}"></image>`; | ||
|
||
export const imagesPrompts = (imageList: ChatImageItem[]) => { | ||
if (imageList.length === 0) return ''; | ||
|
||
const prompt = `<images> | ||
<images_docstring>here are user upload images you can refer to</images_docstring> | ||
${imageList.map((item) => imagePrompt(item)).join('\n')} | ||
</images>`; | ||
|
||
return prompt.trim(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ChatFileItem, ChatImageItem } from '@/types/message'; | ||
|
||
import { filePrompts } from './file'; | ||
import { imagesPrompts } from './image'; | ||
|
||
export const filesPrompts = ({ | ||
imageList, | ||
fileList, | ||
}: { | ||
fileList?: ChatFileItem[]; | ||
imageList: ChatImageItem[]; | ||
}) => { | ||
const prompt = `<files_info> | ||
${imagesPrompts(imageList)} | ||
${fileList ? filePrompts(fileList) : ''} | ||
</files_info>`; | ||
|
||
return prompt.trim(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters