mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-05 20:46:43 +00:00
model pickup
This commit is contained in:
parent
302cd28775
commit
937ba7e61b
@ -64,6 +64,8 @@ export function streamText(
|
||||
let currentModel = DEFAULT_MODEL;
|
||||
let currentProvider = DEFAULT_PROVIDER;
|
||||
|
||||
console.log('StreamText:', JSON.stringify(messages));
|
||||
|
||||
const processedMessages = messages.map((message) => {
|
||||
if (message.role === 'user') {
|
||||
const { model, provider, content } = extractPropertiesFromMessage(message);
|
||||
|
@ -31,11 +31,14 @@ function parseCookies(cookieHeader) {
|
||||
|
||||
async function chatAction({ context, request }: ActionFunctionArgs) {
|
||||
|
||||
const { messages, imageData } = await request.json<{
|
||||
const { messages, imageData, model } = await request.json<{
|
||||
messages: Messages,
|
||||
imageData?: string[]
|
||||
imageData?: string[],
|
||||
model: string
|
||||
}>();
|
||||
|
||||
console.log('ChatAction:', JSON.stringify(messages));
|
||||
|
||||
const cookieHeader = request.headers.get("Cookie");
|
||||
|
||||
// Parse the cookie's value (returns an object or null if no cookie exists)
|
||||
@ -47,6 +50,7 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
|
||||
const options: StreamingOptions = {
|
||||
toolChoice: 'none',
|
||||
apiKeys,
|
||||
model,
|
||||
onFinish: async ({ text: content, finishReason }) => {
|
||||
if (finishReason !== 'length') {
|
||||
return stream.close();
|
||||
|
@ -30,13 +30,15 @@ const PROVIDER_LIST: ProviderInfo[] = [
|
||||
icon: "i-ph:cloud-arrow-down",
|
||||
}, {
|
||||
name: 'OpenAILike',
|
||||
staticModels: [],
|
||||
staticModels: [
|
||||
{ name: 'o1-mini', label: 'o1-mini', provider: 'OpenAILike' },
|
||||
],
|
||||
getDynamicModels: getOpenAILikeModels
|
||||
},
|
||||
{
|
||||
name: 'OpenRouter',
|
||||
staticModels: [
|
||||
{ name: 'gpt-4o', label: 'GPT-4o', provider: 'OpenAI' },
|
||||
{ name: 'gpt-4o', label: 'GPT-4o', provider: 'OpenRouter' },
|
||||
{
|
||||
name: 'anthropic/claude-3.5-sonnet',
|
||||
label: 'Anthropic: Claude 3.5 Sonnet (OpenRouter)',
|
||||
|
Loading…
Reference in New Issue
Block a user