integrate ai gateway and improve ui components (#1145)
This commit is contained in:
parent
7315ced92f
commit
dff2191611
29 changed files with 235 additions and 217 deletions
|
|
@ -9,12 +9,12 @@ export interface ChatModel {
|
|||
export const chatModels: Array<ChatModel> = [
|
||||
{
|
||||
id: 'chat-model',
|
||||
name: 'Chat model',
|
||||
description: 'Primary model for all-purpose chat',
|
||||
name: 'Grok Vision',
|
||||
description: 'Advanced multimodal model with vision and text capabilities',
|
||||
},
|
||||
{
|
||||
id: 'chat-model-reasoning',
|
||||
name: 'Reasoning model',
|
||||
description: 'Uses advanced reasoning',
|
||||
name: 'Grok Reasoning',
|
||||
description: 'Uses advanced chain-of-thought reasoning for complex problems',
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {
|
|||
extractReasoningMiddleware,
|
||||
wrapLanguageModel,
|
||||
} from 'ai';
|
||||
import { xai } from '@ai-sdk/xai';
|
||||
import { gateway } from '@ai-sdk/gateway';
|
||||
import {
|
||||
artifactModel,
|
||||
chatModel,
|
||||
|
|
@ -23,15 +23,12 @@ export const myProvider = isTestEnvironment
|
|||
})
|
||||
: customProvider({
|
||||
languageModels: {
|
||||
'chat-model': xai('grok-2-vision-1212'),
|
||||
'chat-model': gateway.languageModel('xai/grok-2-vision-1212'),
|
||||
'chat-model-reasoning': wrapLanguageModel({
|
||||
model: xai('grok-3-mini-beta'),
|
||||
model: gateway.languageModel('xai/grok-3-mini-beta'),
|
||||
middleware: extractReasoningMiddleware({ tagName: 'think' }),
|
||||
}),
|
||||
'title-model': xai('grok-2-1212'),
|
||||
'artifact-model': xai('grok-2-1212'),
|
||||
},
|
||||
imageModels: {
|
||||
'small-model': xai.imageModel('grok-2-image'),
|
||||
'title-model': gateway.languageModel('xai/grok-2-1212'),
|
||||
'artifact-model': gateway.languageModel('xai/grok-2-1212'),
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { codeDocumentHandler } from '@/artifacts/code/server';
|
||||
import { imageDocumentHandler } from '@/artifacts/image/server';
|
||||
import { sheetDocumentHandler } from '@/artifacts/sheet/server';
|
||||
import { textDocumentHandler } from '@/artifacts/text/server';
|
||||
import type { ArtifactKind } from '@/components/artifact';
|
||||
|
|
@ -93,8 +92,7 @@ export function createDocumentHandler<T extends ArtifactKind>(config: {
|
|||
export const documentHandlersByArtifactKind: Array<DocumentHandler> = [
|
||||
textDocumentHandler,
|
||||
codeDocumentHandler,
|
||||
imageDocumentHandler,
|
||||
sheetDocumentHandler,
|
||||
];
|
||||
|
||||
export const artifactKinds = ['text', 'code', 'image', 'sheet'] as const;
|
||||
export const artifactKinds = ['text', 'code', 'sheet'] as const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue