Skip to content

Commit

Permalink
chore: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
luoling8192 committed Dec 14, 2024
1 parent 44f2126 commit f758773
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 36 deletions.
32 changes: 4 additions & 28 deletions packages/neuri/src/openai-xsai/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,10 @@ export function imagePart(imageUrl: string): ImagePart {
return { type: 'image_url', image_url: { url: imageUrl } }
}

// TODO: AssistantMessage
// interface ToolCallMessage {
// function: {
// arguments: string
// name: string
// }
// id: string
// type: 'function'
// }
// export function assistant(toolCall: ToolCallMessage | undefined): { role: 'assistant', tool_calls: ToolCallMessage[], name?: string }
// export function assistant(message: string): { role: 'assistant', content: string, name?: string }
// export function assistant(body: string | ToolCallMessage | undefined): AssistantMessage {
// if (body == null)
// return { role: 'assistant', content: '' }
// if (typeof body === 'string')
// return { role: 'assistant', content: body }

// return { role: 'assistant', tool_calls: [body] }
// }

// export function tool<P = any, R = any>(message: string, toolCall: ResolvedToolCall<P, R>): OpenAI.ChatCompletionToolMessageParam {
// return {
// role: 'tool',
// content: message,
// tool_call_id: toolCall.toolCall.id,
// }
// }

export function messages(...messages: Message[]): Message[] {
return messages
}

export function assistant(message: string): AssistantMessage {
return { role: 'assistant', content: message }
}
10 changes: 2 additions & 8 deletions packages/neuri/src/openai-xsai/stream.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { env } from 'node:process'
import { createOpenAI } from '@xsai/providers'
import { describe, expect, it } from 'vitest'
import { messages, system, user } from './messages'
import { createOpenAIProvider } from './provider'
Expand Down Expand Up @@ -40,16 +39,11 @@ describe('stream', () => {
// TODO: auto tee?
it('should stream chunkStream', async () => {
const apiKey = env.OPENAI_API_KEY || env.VITE_OPENAI_API_KEY
let baseURL = env.OPENAI_API_BASEURL || env.VITE_OPENAI_API_BASEURL
const baseURL = env.OPENAI_API_BASEURL || env.VITE_OPENAI_API_BASEURL
expect(apiKey).toBeDefined()
expect(baseURL).toBeDefined()

if (!baseURL?.endsWith('/')) {
baseURL += '/'
}

// TODO: fix baseURL
const openAI = createOpenAI({
const openAI = createOpenAIProvider({
apiKey: apiKey!,
baseURL: baseURL!,
})
Expand Down

0 comments on commit f758773

Please sign in to comment.