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
14 changes: 14 additions & 0 deletions frontend/app/aipanel/aipanelmessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const AIPanelMessages = memo(({ messages, status, onContextMenu }: AIPane
const isPanelOpen = useAtomValue(model.getPanelVisibleAtom());
const messagesEndRef = useRef<HTMLDivElement>(null);
const messagesContainerRef = useRef<HTMLDivElement>(null);
const prevStatusRef = useRef<string>(status);

const scrollToBottom = () => {
const container = messagesContainerRef.current;
Expand All @@ -41,6 +42,19 @@ export const AIPanelMessages = memo(({ messages, status, onContextMenu }: AIPane
}
}, [isPanelOpen]);

useEffect(() => {
const wasStreaming = prevStatusRef.current === "streaming";
const isNowNotStreaming = status !== "streaming";

if (wasStreaming && isNowNotStreaming) {
requestAnimationFrame(() => {
scrollToBottom();
});
}

prevStatusRef.current = status;
}, [status]);

return (
<div
ref={messagesContainerRef}
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/store/keymodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ function switchBlockInDirection(direction: NavigateDirection) {
}
if (numBlocks === 1) {
FocusManager.getInstance().requestWaveAIFocus();
setTimeout(() => {
FocusManager.getInstance().refocusNode();
}, 10);
return;
}
}
Expand All @@ -249,6 +252,9 @@ function switchBlockInDirection(direction: NavigateDirection) {
const navResult = layoutModel.switchNodeFocusInDirection(direction, inWaveAI);
if (navResult.atLeft) {
FocusManager.getInstance().requestWaveAIFocus();
setTimeout(() => {
FocusManager.getInstance().refocusNode();
}, 10);
return;
}
setTimeout(() => {
Expand Down
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"vitest": "^3.0.9"
},
"dependencies": {
"@ai-sdk/react": "^2.0.76",
"@ai-sdk/react": "^2.0.92",
"@floating-ui/react": "^0.27.16",
"@monaco-editor/loader": "^1.5.0",
"@monaco-editor/react": "^4.7.0",
Expand All @@ -104,7 +104,7 @@
"@xterm/addon-web-links": "^0.11.0",
"@xterm/addon-webgl": "^0.18.0",
"@xterm/xterm": "^5.5.0",
"ai": "^5.0.44",
"ai": "^5.0.92",
"base64-js": "^1.5.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
Expand Down
5 changes: 4 additions & 1 deletion pkg/aiusechat/openai/openai-backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ type OpenAIMessageContent struct {
}

func (c *OpenAIMessageContent) clean() *OpenAIMessageContent {
if c.PreviewUrl == "" {
if c.PreviewUrl == "" && (c.Type != "input_image" || c.Filename == "") {
return c
}
rtn := *c
rtn.PreviewUrl = ""
if c.Type == "input_image" {
rtn.Filename = ""
}
return &rtn
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/aiusechat/openai/openai-convertmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func convertContentBlockToParts(block OpenAIMessageContent, role string) []uctyp
parts = append(parts, uctypes.UIMessagePart{
Type: "data-userfile",
Data: uctypes.UIMessageDataUserFile{
FileName: block.Filename,
MimeType: "image/*",
PreviewUrl: block.PreviewUrl,
},
Expand Down Expand Up @@ -317,6 +318,7 @@ func convertFileAIMessagePart(part uctypes.AIMessagePart) (*OpenAIMessageContent
return &OpenAIMessageContent{
Type: "input_image",
ImageUrl: imageUrl,
Filename: part.FileName,
PreviewUrl: part.PreviewUrl,
}, nil

Expand Down
Loading