- Switch conversation agent to xiaomi/mimo-v2.5 (multimodal: text + image) - Render native reasoning parts as live 'Thinking trace' (streaming open, collapsed after completion); inline <think> extraction for streaming models - Image attachments: picker (up to 4, 10MB each), base64 to Flue AgentPromptImage, authenticated blob-URL replay for historical images - Mobile keyboard viewport fix: visual-viewport hook, fixed shell, interactive-widget=resizes-content, header pinned, composer follows keyboard - Conversation to Signal to proposed Work: Convex persistence, Effect validation in @code/work-os, Work cards with exact source provenance - Streamdown markdown + Mermaid chart rendering in chat messages - Flue tool turns hidden, reasoning-containing turns remain visible - Frontend regression tests: keyboard viewport, responsive shell, attachment overflow, authenticated images, reasoning traces, transforms - .env.example updated to xiaomi/mimo-v2.5 config
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import type { SendMessageOptions } from "@flue/react";
|
|
import { useFlueAgent } from "@flue/react";
|
|
|
|
import { usePersonalOrganization } from "@/hooks/use-personal-organization";
|
|
import type { PersonalOrganizationState } from "@/hooks/use-personal-organization";
|
|
import { CHAT_AGENT } from "@/lib/chat/constants";
|
|
import type { ChatAgentState } from "@/lib/chat/types";
|
|
|
|
export const useOrganizationChatAgent = (
|
|
organization: PersonalOrganizationState
|
|
): ChatAgentState => {
|
|
const agent = useFlueAgent({
|
|
...CHAT_AGENT,
|
|
id: organization.organizationId,
|
|
});
|
|
|
|
const sendMessage = async (
|
|
message: string,
|
|
options?: SendMessageOptions
|
|
): Promise<void> => {
|
|
if (!organization.organizationId) {
|
|
throw (
|
|
organization.error ??
|
|
new Error("Personal organization is still being prepared")
|
|
);
|
|
}
|
|
await agent.sendMessage(message, options);
|
|
};
|
|
|
|
let { status } = agent;
|
|
if (!organization.organizationId) {
|
|
status = organization.error ? "error" : "connecting";
|
|
}
|
|
|
|
return {
|
|
error: organization.error ?? agent.error,
|
|
historyReady: agent.historyReady,
|
|
messages: agent.messages,
|
|
sendMessage,
|
|
status,
|
|
};
|
|
};
|
|
|
|
export const useChatAgent = (): ChatAgentState =>
|
|
useOrganizationChatAgent(usePersonalOrganization());
|