Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include URL location in copilot mode when sending a message #1403

Merged
merged 2 commits into from
Oct 8, 2024
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
5 changes: 2 additions & 3 deletions backend/chainlit/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,17 @@ def __post_init__(self) -> None:
@classmethod
def from_dict(self, _dict: StepDict):
type = _dict.get("type", "assistant_message")
message = Message(
return Message(
id=_dict["id"],
parent_id=_dict.get("parentId"),
created_at=_dict["createdAt"],
content=_dict["output"],
author=_dict.get("name", config.ui.name),
type=type, # type: ignore
language=_dict.get("language"),
metadata=_dict.get("metadata", {}),
)

return message

def to_dict(self) -> StepDict:
_dict: StepDict = {
"id": self.id,
Expand Down
3 changes: 2 additions & 1 deletion libs/copilot/src/components/InputBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const InputBox = memo(
name: user?.identifier || 'User',
type: 'user_message',
output: msg,
createdAt: new Date().toISOString()
createdAt: new Date().toISOString(),
metadata: {location: window.location.href},
};

setInputHistory((old) => {
Expand Down
1 change: 1 addition & 0 deletions libs/react-client/src/types/step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface IStep {
language?: string;
streaming?: boolean;
steps?: IStep[];
metadata?: Record<string, any>;
//legacy
indent?: number;
}
Loading