Skip to content

Commit

Permalink
Upgrade Claude.ai to the lastest API
Browse files Browse the repository at this point in the history
fix #685
  • Loading branch information
sunner committed Jan 15, 2024
1 parent 9a7488c commit fb62d73
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/bots/ClaudeAIBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,22 @@ export default class ClaudeAIBot extends Bot {
accept: "text/event-stream, text/event-stream",
"Content-Type": "application/json",
};
const url = `https://claude.ai/api/organizations/${store.state.claudeAi.org}/chat_conversations/${context.uuid}/completion`;
const payload = JSON.stringify({
attachments: [],
completion: {
incremental: true,
model: "claude-2.0",
prompt: prompt,
},
conversation_uuid: context.uuid,
organization_uuid: store.state.claudeAi.org,
text: prompt,
model: "claude-2.1",
prompt: prompt,
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
});
return new Promise((resolve, reject) => {
try {
const source = new SSE("https://claude.ai/api/append_message", {
const source = new SSE(url, {
headers,
payload,
withCredentials: true,
});
let text = "";
source.addEventListener("message", (event) => {
source.addEventListener("completion", (event) => {
try {
const data = JSON.parse(event.data);
if (data.completion) {
Expand Down

1 comment on commit fb62d73

@vercel
Copy link

@vercel vercel bot commented on fb62d73 Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chatall – ./

chatall-llm.vercel.app
chatall-sunner.vercel.app
chatall-git-main-sunner.vercel.app

Please sign in to comment.