Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
guaguaguaxia committed Oct 15, 2024
1 parent 1a61f9f commit 884786c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pages/api/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const handler = async (req: Request): Promise<Response> => {
// }

const payload: OpenAIStreamPayload = {
model: "gpt-3.5-turbo",
model: "moonshot-v1-8k",
messages: [{ role: "user", content: prompt }],
temperature: 0.7,
top_p: 1,
Expand Down
3 changes: 2 additions & 1 deletion utils/OpenAIStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function OpenAIStream(payload: OpenAIStreamPayload) {
}
delete payload.api_key

const res = await fetch("http://15.204.101.64:4000/v1/chat/completions", {
const res = await fetch("https://api.moonshot.cn/v1/chat/completions", {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${openai_api_key ?? ""}`,
Expand All @@ -67,6 +67,7 @@ export async function OpenAIStream(payload: OpenAIStreamPayload) {
async start(controller) {
// callback
function onParse(event: ParsedEvent | ReconnectInterval) {
console.log(event.type)
if (event.type === "event") {
const data = event.data;
// https://beta.openai.com/docs/api-reference/completions/create#completions/create-stream
Expand Down

0 comments on commit 884786c

Please sign in to comment.