Files
PiAgentUI/src/utils/messageConversion.ts
Evandro b3489e1ede
Build & Push Frontend Docker Image / build-and-push (push) Canceled after 0s
Build Validation / validate (push) Canceled after 6s
Build & Push Backend Docker Image / build-and-push (push) Failing after 10m10s
Build & Push Gateway Docker Image / build-and-push (push) Failing after 10m9s
🎉 Initial commit: PiAgentUI — AI Agent Desktop & Web UI
A professional workspace for AI coding agents with:
- Real-time streaming chat with SSE
- Session management (fork, clone, tree navigation)
- MCP tools browser & metadata panel
- Skills browser (global, project, package sources)
- Voice input & STT provider configuration
- Integrated terminal & file explorer
- Model selector with capability metadata
- Keyboard-first UI with command palette
- 8 languages (en, pt-BR, es, ja, zh-CN, ar, bn, hi)
- Tauri 2 desktop app
- React 19 + TypeScript + Vite 8 + Tailwind CSS 4
- Pi Agent extension runtime

Originally forked from OpenCodeUI, now an independent project.
License: GPL-3.0-only
2026-06-01 00:50:06 -03:00

37 lines
1.2 KiB
TypeScript

import type { ApiMessage, ApiMessageWithParts, ApiPart } from '../api/types'
import type { Message, MessageInfo, Part, UserMessageInfo } from '../types/message'
import { isUserMessage } from '../types/message'
type ApiMessageEnvelope = ApiMessageWithParts | { message: ApiMessageWithParts['info']; parts: ApiMessageWithParts['parts'] }
function getEnvelopeInfo(apiMessage: ApiMessageEnvelope): ApiMessageWithParts['info'] {
return 'info' in apiMessage ? apiMessage.info : apiMessage.message
}
export function toUIMessage(apiMessage: ApiMessageEnvelope): Message {
return {
info: getEnvelopeInfo(apiMessage) as MessageInfo,
parts: apiMessage.parts as Part[],
isStreaming: false,
}
}
export function toUIMessageInfo(apiMessage: ApiMessage): MessageInfo {
return apiMessage as MessageInfo
}
export function toUIPart(apiPart: ApiPart): Part {
return apiPart as Part
}
export function toApiMessageWithParts(message: Pick<Message, 'info' | 'parts'>): ApiMessageWithParts {
return {
info: message.info as ApiMessageWithParts['info'],
parts: message.parts as ApiMessageWithParts['parts'],
}
}
export function isUserUIMessage(message: Message): message is Message & { info: UserMessageInfo } {
return isUserMessage(message.info)
}