chore: merge main
This commit is contained in:
parent
6df0cc140b
commit
f76c69dfda
3 changed files with 36 additions and 2 deletions
|
|
@ -14,6 +14,11 @@ import {
|
|||
import { stripImages } from "../images.js";
|
||||
import { BaseLLM } from "../index.js";
|
||||
|
||||
/**
|
||||
* Bedrock class implements AWS Bedrock LLM integration.
|
||||
* It handles streaming completions and chat messages using AWS Bedrock runtime.
|
||||
* Supports both text and image inputs through Claude 3 models.
|
||||
*/
|
||||
class Bedrock extends BaseLLM {
|
||||
static providerName: ModelProvider = "bedrock";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
|
|
@ -120,7 +125,9 @@ class Bedrock extends BaseLLM {
|
|||
// TODO: Additionally, consider implementing a global exception handler for the providers to give users clearer feedback.
|
||||
// For example, differentiate between client-side errors (4XX status codes) and server-side issues (5XX status codes),
|
||||
// providing meaningful error messages to improve the user experience.
|
||||
stopSequences: options.stop?.filter((stop) => stop.trim() !== "").slice(0, 4),
|
||||
stopSequences: options.stop
|
||||
?.filter((stop) => stop.trim() !== "")
|
||||
.slice(0, 4),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -162,7 +169,7 @@ class Bedrock extends BaseLLM {
|
|||
try {
|
||||
return await fromIni({
|
||||
profile: this.profile,
|
||||
ignoreCache: true
|
||||
ignoreCache: true,
|
||||
})();
|
||||
} catch (e) {
|
||||
console.warn(
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ export default function StepContainer(props: StepContainerProps) {
|
|||
<StyledMarkdownPreview
|
||||
isRenderingInStepContainer
|
||||
source={stripImages(props.item.message.content)}
|
||||
itemIndex={props.index}
|
||||
/>
|
||||
)}
|
||||
</ContentDiv>
|
||||
|
|
|
|||
|
|
@ -256,4 +256,30 @@ function resolveParagraph(p: JSONContent): [string, MentionAttrs[], string] {
|
|||
return [text, contextItems, slashCommand];
|
||||
}
|
||||
|
||||
export function hasSlashCommandOrContextProvider(
|
||||
editorState: JSONContent,
|
||||
): boolean {
|
||||
if (!editorState.content) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const p of editorState.content) {
|
||||
if (p.type === "paragraph" && p.content) {
|
||||
for (const child of p.content) {
|
||||
if (child.type === "slashcommand") {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
child.type === "mention" &&
|
||||
child.attrs?.itemType === "contextProvider"
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export default resolveEditorContent;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue